@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* Sidebar - dark premium */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 268px;
    height: 100%;
    background: var(--bg-sidebar);
    z-index: 1000;
    transition: transform 0.3s, width 0.3s;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .sidebar-text { display: none; }
.sidebar.collapsed .sidebar-quick { display: none; }

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar .logo {
    font-size: 17px;
    font-weight: 800;
    color: #fff;
    -webkit-text-fill-color: #fff;
}
.sidebar .logo i { color: var(--accent); }
.sidebar-logo-img {
    max-width: 42px;
    max-height: 42px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    background: rgba(255,255,255,.1);
}

/* Site footer bar (dashboard / all app pages) */
.platform-credit-wrap--app {
    width: 100%;
    margin-top: 36px;
    padding-top: 8px;
}

.platform-credit--app {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 20px 32px;
    width: 100%;
    padding: 18px 24px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
}

.platform-credit--app .pc-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.platform-credit--app .pc-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.platform-credit--app .pc-brand {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

.platform-credit--app .pc-vrule {
    width: 1px;
    height: 44px;
    background: var(--border);
    border-radius: 2px;
}

.platform-credit--app .pc-phone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-link);
    text-decoration: none;
    padding: 8px 18px;
    background: var(--primary-light);
    border-radius: 999px;
    border: 1px solid var(--border);
}

.platform-credit--app .pc-phone:hover {
    color: var(--primary-dark);
    background: var(--bg-surface-2);
}

.sidebar-platform { font-size: 11px; color: rgba(255,255,255,0.75); }
.sidebar-quick { padding: 0 12px 12px; }
.sidebar-quick .btn-primary {
    background: var(--primary);
    border: none;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(4, 120, 87, 0.35);
    color: #fff;
}
.sidebar-quick .btn-primary:hover {
    background: var(--primary-dark);
}

.nav-menu { padding: 8px 0; flex: 1; list-style: none; }
.nav-item { margin: 2px 10px; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.nav-link i { width: 22px; text-align: center; font-size: 17px; }
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    margin-top: auto;
}
.sidebar-footer .nav-link { color: #94a3b8; }
.sidebar-footer .nav-link:hover { color: #fff; background: rgba(255,255,255,0.1); }
.platform-credit-sidebar {
    color: rgba(255,255,255,0.9) !important;
    text-align: center;
    padding-top: 8px;
}
.platform-credit-sidebar a {
    color: #6ee7b7 !important;
    font-weight: 700;
}

.brand-top-banner {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
    background: #1a0a2e;
}
.brand-top-banner img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    display: block;
}
.brand-top-banner-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 16px;
    background: linear-gradient(transparent, rgba(26,10,46,.85));
    color: #fff;
    font-size: 13px;
}

.modal-header-brand {
    background: var(--primary-dark);
    border: none;
}
.btn-brand-save {
    background: var(--primary);
    border: none;
    color: #fff;
    font-weight: 700;
}
.btn-brand-save:hover {
    color: #fff;
    background: var(--primary-dark);
    box-shadow: 0 4px 14px rgba(4, 120, 87, 0.3);
}

.workflow-steps .workflow-step {
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    padding: 12px 10px;
    height: 100%;
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.workflow-steps .workflow-step small {
    color: var(--text-muted) !important;
}
.workflow-steps .step-num {
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 6px;
}
.workflow-steps .active-step {
    border-color: var(--primary);
    background: var(--primary-light);
}
.workflow-steps .active-step .step-num {
    background: var(--primary);
}

.sidebar-platform-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    line-height: 1.4;
}
.sidebar-platform-link:hover {
    color: #6ee7b7;
    text-decoration: underline;
}

.platform-credit--app .pc-brand,
.platform-credit--login .pc-brand {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 800;
}
.platform-credit--app .pc-brand:hover,
.platform-credit--login .pc-brand:hover {
    color: var(--text-link);
    text-decoration: underline;
}

/* Main */
.main-content {
    margin-left: 268px;
    padding: 16px 20px 90px;
    min-height: 100vh;
    transition: margin 0.3s;
}
.main-content.expanded { margin-left: 72px; }

.top-bar {
    background: var(--bg-surface);
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.top-bar h4,
.top-bar .text-dark {
    color: var(--text-primary) !important;
}

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
    color: var(--text-primary);
}
.card-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 18px;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}
.card-body { padding: 18px; }

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
    color: var(--text-primary);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-info h3 { font-size: 26px; font-weight: 800; color: var(--text-primary); }
.stat-info p { color: var(--text-muted); font-size: 13px; margin: 0; }
.stat-info small { color: var(--text-muted); }
.stat-info small a { color: var(--text-link); font-weight: 600; }
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.btn-primary {
    background: var(--primary);
    border: none;
    font-weight: 600;
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Quick actions */
.quick-actions .quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}
.quick-actions .quick-btn:hover {
    border-color: var(--primary);
    color: var(--text-link);
    box-shadow: var(--shadow);
}
.quick-actions .quick-btn i { font-size: 24px; color: var(--primary); margin-bottom: 8px; }

/* Khata - traditional style */
.khata-ledger-wrap { overflow-x: auto; }
table.khata-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table.khata-table thead th {
    background: linear-gradient(180deg, #fef3c7, #fde68a);
    color: #92400e;
    padding: 12px 10px;
    border: 2px solid #d97706;
    font-weight: 700;
    text-align: center;
}
table.khata-table tbody td {
    padding: 10px;
    border: 1px solid #e7e5e4;
    text-align: center;
    vertical-align: middle;
}
table.khata-table .col-debit { color: var(--danger); font-weight: 700; }
table.khata-table .col-credit { color: var(--success, #16a34a); font-weight: 700; }
table.khata-table .col-balance {
    font-weight: 800;
    background: #fffbeb;
    color: #92400e;
}
.khata-header-name {
    background: linear-gradient(135deg, #fff7ed, #ffedd5);
    border: 3px double var(--primary);
    padding: 20px;
    text-align: center;
    border-radius: var(--radius);
    margin-bottom: 20px;
}
.khata-header-name h3 { color: var(--primary-dark); font-size: 24px; margin: 0; }
.khata-header-name .label { font-size: 12px; color: var(--gray); }

.khata-box {
    padding: 16px 12px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 2px solid transparent;
}
.khata-box small {
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
    color: inherit;
    opacity: 0.95;
}
.khata-box h4,
.khata-box h5 {
    color: inherit !important;
    font-weight: 800;
}
.khata-pending {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}
.khata-wasool {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}
.khata-udhar {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fed7aa;
}
.khata-opening {
    background: #f5f5f4;
    color: #44403c;
    border-color: #e7e5e4;
}
.khata-row-opening {
    background: #fff7ed;
}
.khata-table-footer {
    background: linear-gradient(180deg, #fff7ed, #ffedd5);
    font-size: 16px;
}
.khata-table-footer .col-balance-total {
    color: #b91c1c !important;
    font-weight: 800;
}

.color-dot { width: 18px; height: 18px; border-radius: 4px; border: 1px solid #ccc; display: inline-block; }
.color-dot-neutral { background: #f1f5f9; color: #64748b; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; }

.guide-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    height: 100%;
    text-align: center;
}
.guide-icon {
    width: 56px; height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    color: #fff;
    font-size: 22px;
}

/* POS layout: see assets/css/pos.css (body.page-pos) */
.category-pick-card:hover {
    border-color: var(--brand-primary, #047857);
    box-shadow: 0 4px 14px rgba(4, 120, 87, 0.15);
    transform: translateY(-2px);
}
.category-pick-card i { color: var(--brand-primary, #047857); }
body.dark-mode .category-pick-card { background: #1e293b; border-color: #334155; color: #e2e8f0; }
.product-stock-badge { margin-top: 4px; }
.product-card {
    background: var(--bg-surface-2);
    border: 2px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}
.product-card .pname { font-size: 13px; font-weight: 600; min-height: 36px; line-height: 1.3; }
.product-card:active, .product-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.pos-total-box {
    background: var(--primary-dark);
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}
.pos-total-box .amount { font-size: 1.75rem; font-weight: 800; }
.prev-balance-alert {
    background: #fff7ed;
    border: 2px solid #fdba74;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 10px;
}
.prev-balance-alert strong { color: var(--primary-dark); }

.cat-filter { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.cat-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 100px;
    padding: 16px 14px;
    border: 2px solid var(--border);
    background: var(--bg-surface);
    border-radius: 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
}
.cat-btn i {
    font-size: 2.5rem;
    line-height: 1;
    color: var(--primary);
}
.cat-btn span { line-height: 1.25; text-align: center; max-width: 88px; }
.cat-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.cat-btn.active {
    background: var(--primary);
    color: var(--text-on-primary);
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(4, 120, 87, 0.35);
}
.cat-btn.active i { color: var(--text-on-primary); }
body.dark-mode .cat-btn.active { color: #0f172a; }
body.dark-mode .cat-btn.active i { color: #0f172a; }
.product-card .cat-icon { color: var(--primary); }
.product-card.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.product-card.active .cat-icon { color: #fff; }
.product-card.active .text-primary { color: #d1fae5 !important; }
.product-card:hover .cat-icon,
.product-card.active .cat-icon { color: inherit; }

/* Mobile bottom nav */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 999;
    box-shadow: 0 -4px 20px rgb(0 0 0 / 0.08);
}
.mobile-nav a {
    flex: 1;
    text-align: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    padding: 4px;
}
.mobile-nav a i { display: block; font-size: 20px; margin-bottom: 2px; }
.mobile-nav a.active { color: var(--primary); }
.mobile-nav a.pos-fab {
    flex: 0 0 auto;
    margin-top: -20px;
}
.mobile-nav a.pos-fab span {
    display: flex;
    width: 52px; height: 52px;
    background: var(--primary);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    box-shadow: 0 4px 16px rgba(4, 120, 87, 0.4);
    margin: 0 auto 4px;
}

/* Mobile menu toggle */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 1001;
    width: 44px; height: 44px;
    border-radius: 12px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 18px;
    box-shadow: var(--shadow-md);
}

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); width: 280px; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; padding-bottom: 100px; }
    .app-main-footer .platform-credit-wrap { max-width: 100%; padding: 0 8px; }
    .cat-btn { min-width: 64px; padding: 8px 10px; font-size: 10px; }
    .cat-btn i { font-size: 1.15rem; }
    .mobile-nav { display: flex; align-items: flex-end; }
    .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
    body:not(.page-pos) .pos-wrap { flex-direction: column; min-height: auto; }
    body:not(.page-pos) .pos-cart { max-width: 100%; min-width: 0; }
    #toggleSidebar { display: none; }
}

/* Dark mode — semantic tokens from theme.css */
body.dark-mode .nav-link { color: var(--text-on-sidebar); }
body.dark-mode .nav-link.active {
    background: var(--primary);
    color: #0f172a;
}
body.dark-mode .sidebar-quick .btn-primary {
    color: #0f172a;
}

body.dark-mode .form-control,
body.dark-mode .auth-input {
    background-color: var(--bg-input) !important;
    border-color: var(--border-strong) !important;
    color: var(--text-primary) !important;
    background-image: none !important;
}
body.dark-mode .form-select,
body.dark-mode .ledger-customer-select {
    background-color: var(--bg-input) !important;
    border-color: var(--border-strong) !important;
    color: var(--text-primary) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23e2e8f0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.75rem center !important;
    background-size: 16px 12px !important;
}
body.dark-mode .form-select option,
body.dark-mode .ledger-customer-select option {
    background: #1e293b;
    color: #f1f5f9;
}
body.dark-mode .form-control:focus,
body.dark-mode .auth-input:focus {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
    background-image: none !important;
}
body.dark-mode .form-select:focus,
body.dark-mode .ledger-customer-select:focus {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}
body.dark-mode .form-control::placeholder {
    color: var(--text-muted);
}

body.dark-mode .text-muted,
body.dark-mode .text-secondary,
body.dark-mode small.text-muted {
    color: var(--text-muted) !important;
}
body.dark-mode .text-dark,
body.dark-mode .text-body,
body.dark-mode label,
body.dark-mode .form-label {
    color: var(--text-secondary) !important;
}
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3,
body.dark-mode h4, body.dark-mode h5, body.dark-mode h6,
body.dark-mode .card-title {
    color: var(--text-primary);
}

body.dark-mode .table,
body.dark-mode .table td,
body.dark-mode .table th,
body.dark-mode .dataTables_wrapper {
    color: var(--text-primary);
}
body.dark-mode table.dataTable thead th {
    background: var(--bg-surface-2) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}
body.dark-mode table.dataTable tbody tr {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}
body.dark-mode table.dataTable tbody tr:hover {
    background: var(--bg-surface-2) !important;
}
body.dark-mode table.dataTable.stripe tbody tr.odd {
    background: var(--bg-surface-2) !important;
}
body.dark-mode .dataTables_filter input,
body.dark-mode .dataTables_length select {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}
body.dark-mode .dataTables_info,
body.dark-mode .dataTables_paginate {
    color: var(--text-muted) !important;
}
body.dark-mode .page-link {
    background: var(--bg-surface-2);
    border-color: var(--border);
    color: var(--text-primary);
}

body.dark-mode .alert-light {
    background: var(--bg-surface-2);
    border-color: var(--border);
    color: var(--text-primary);
}
body.dark-mode .alert-primary {
    background: var(--primary-light);
    border-color: var(--border);
    color: var(--text-primary);
}
body.dark-mode .alert-success {
    background: #14532d;
    border-color: #166534;
    color: #bbf7d0;
}
body.dark-mode .alert-danger {
    background: #450a0a;
    border-color: #991b1b;
    color: #fecaca;
}
body.dark-mode .alert-warning {
    background: #422006;
    border-color: #92400e;
    color: #fde68a;
}

body.dark-mode .badge.bg-light {
    background: var(--bg-surface-2) !important;
    color: var(--text-primary) !important;
}
body.dark-mode .badge.bg-primary,
body.dark-mode .badge.bg-success,
body.dark-mode .badge.bg-warning,
body.dark-mode .badge.bg-danger {
    color: #0f172a !important;
}

body.dark-mode .btn-outline-primary,
body.dark-mode .btn-outline-secondary,
body.dark-mode .btn-outline-success,
body.dark-mode .btn-outline-warning,
body.dark-mode .btn-outline-danger {
    color: var(--text-link);
    border-color: var(--border-strong);
}
body.dark-mode .btn-outline-primary:hover {
    background: var(--primary-light);
    color: var(--text-primary);
}
body.dark-mode .btn-light {
    background: var(--bg-surface-2);
    border-color: var(--border);
    color: var(--text-primary);
}
body.dark-mode .btn-primary {
    color: #0f172a;
}

body.dark-mode .product-card {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}
body.dark-mode .product-card .text-primary {
    color: var(--text-link) !important;
}
body.dark-mode .product-card.active {
    background: var(--primary);
    color: #0f172a;
}
body.dark-mode .product-card.active .text-primary,
body.dark-mode .product-card.active .cat-icon {
    color: #0f172a !important;
}
body.dark-mode .cat-btn:hover {
    background: var(--bg-surface-2);
}
body.dark-mode .cat-btn i {
    color: var(--text-link);
}

body.dark-mode .modal-content {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border);
}
body.dark-mode .modal-body {
    background: var(--bg-surface);
    color: var(--text-primary);
}
body.dark-mode .modal-footer {
    background: var(--bg-surface);
    border-color: var(--border);
}
body.dark-mode .modal-header:not(.modal-header-brand) {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border-color: var(--border);
}
body.dark-mode .modal-header-brand {
    color: #0f172a;
}
body.dark-mode .modal-header-brand .btn-close-white {
    filter: none;
}
body.dark-mode .btn-close {
    filter: invert(1);
}

body.dark-mode .pos-variant-btn {
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border-color: var(--border) !important;
}
body.dark-mode .pos-variant-btn:hover {
    background: var(--bg-surface-2) !important;
}
body.dark-mode .list-group-item {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border);
}
body.dark-mode .dropdown-menu {
    background: var(--bg-surface);
    border-color: var(--border);
}
body.dark-mode .dropdown-item {
    color: var(--text-primary);
}
body.dark-mode .dropdown-item:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

body.dark-mode .guide-card {
    background: var(--bg-surface);
    color: var(--text-primary);
}
body.dark-mode .prev-balance-alert {
    background: var(--bg-surface-2);
    border-color: var(--warning);
    color: var(--text-primary);
}
body.dark-mode .prev-balance-alert strong {
    color: var(--text-link);
}
body.dark-mode .cart-item {
    border-color: var(--border);
    color: var(--text-primary);
}
body.dark-mode .pos-total-box {
    color: #0f172a;
}
body.dark-mode code {
    background: var(--bg-surface-2);
    color: var(--text-link);
}

body.dark-mode .khata-header-name {
    background: var(--bg-surface-2);
    border-color: var(--border);
}
body.dark-mode .khata-header-name h3,
body.dark-mode .khata-header-name small {
    color: var(--text-primary);
}
body.dark-mode .khata-header-name .label {
    color: var(--text-muted);
}
body.dark-mode table.khata-table thead th {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border-color: var(--border);
}
body.dark-mode table.khata-table tbody td {
    color: var(--text-primary);
    border-color: var(--border);
}
body.dark-mode table.khata-table .col-debit {
    color: #fca5a5 !important;
}
body.dark-mode table.khata-table .col-credit {
    color: #86efac !important;
}
body.dark-mode table.khata-table .col-balance {
    background: var(--bg-surface-2);
    color: #fde68a !important;
}
body.dark-mode .khata-pending {
    background: #7f1d1d;
    color: #fecaca;
    border-color: #b91c1c;
}
body.dark-mode .khata-udhar {
    background: #9a3412;
    color: #ffedd5;
    border-color: #c2410c;
}
body.dark-mode .khata-wasool {
    background: #166534;
    color: #bbf7d0;
    border-color: #22c55e;
}
body.dark-mode .khata-opening {
    background: #334155;
    color: #f1f5f9;
    border-color: #64748b;
}
body.dark-mode .khata-box small,
body.dark-mode .khata-box h4,
body.dark-mode .khata-box h5 {
    color: inherit !important;
}
body.dark-mode .khata-row-opening {
    background: var(--bg-surface-2);
}
body.dark-mode .khata-row-opening td {
    color: var(--text-primary);
}
body.dark-mode .khata-table-footer {
    background: var(--bg-surface-2);
}
body.dark-mode .khata-table-footer td {
    color: var(--text-primary) !important;
}
body.dark-mode .khata-table-footer .col-balance-total {
    color: #fca5a5 !important;
}

body.dark-mode .platform-credit--app .pc-phone {
    color: var(--text-primary);
    background: var(--bg-surface-2);
}
body.dark-mode ::-webkit-scrollbar-thumb {
    background: var(--border-strong);
}

/* ========== Global readability (light + dark) ========== */
.guide-card h5,
.guide-card p {
    color: var(--text-primary);
}
.guide-card p {
    color: var(--text-secondary);
}

body.dark-mode .text-primary { color: var(--text-link) !important; }
body.dark-mode .text-success { color: #86efac !important; }
body.dark-mode .text-warning { color: #fde68a !important; }
body.dark-mode .text-danger { color: #fca5a5 !important; }
body.dark-mode .text-info { color: #7dd3fc !important; }
body.dark-mode .text-dark { color: var(--text-primary) !important; }
body.dark-mode strong { color: var(--text-primary); }

body.dark-mode .table,
body.dark-mode .table td,
body.dark-mode .table th,
body.dark-mode .table td strong,
body.dark-mode .table-hover tbody tr {
    color: var(--text-primary);
    border-color: var(--border);
}
body.dark-mode .table thead th {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}
body.dark-mode .table-hover tbody tr:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}
body.dark-mode .table-bordered td,
body.dark-mode .table-bordered th {
    border-color: var(--border);
    color: var(--text-primary);
}

body.dark-mode [class*="bg-opacity"] {
    --bs-bg-opacity: 1 !important;
    background-color: var(--bg-surface-2) !important;
}
body.dark-mode .stat-icon.text-primary { color: #6ee7b7 !important; }
body.dark-mode .stat-icon.text-success { color: #86efac !important; }
body.dark-mode .stat-icon.text-warning { color: #fde68a !important; }
body.dark-mode .stat-icon.text-danger { color: #fca5a5 !important; }

body.dark-mode .badge.bg-primary.bg-opacity-10,
body.dark-mode .badge.bg-primary.bg-opacity-10.text-primary {
    background: var(--primary-light) !important;
    color: var(--text-link) !important;
}
body.dark-mode .badge.bg-primary { color: #0f172a !important; }
body.dark-mode .badge.bg-success { color: #0f172a !important; }
body.dark-mode .badge.bg-danger { color: #fff !important; }
body.dark-mode .badge.bg-warning { color: #0f172a !important; }
body.dark-mode .badge.bg-info { color: #0f172a !important; }
body.dark-mode .badge.bg-secondary { color: #e2e8f0 !important; }

body.dark-mode .top-bar .badge.bg-light,
body.dark-mode .badge.bg-light.text-dark {
    background: var(--bg-surface-2) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .card-header.bg-danger {
    color: #fff !important;
}
body.dark-mode .card-header.bg-danger + .card-body,
body.dark-mode .card-header.bg-danger ~ .card-body {
    color: var(--text-primary);
}
body.dark-mode .card-header.bg-danger + .card-body .border-bottom {
    border-color: var(--border) !important;
}
body.dark-mode .card-header.bg-danger + .card-body .text-success {
    color: #86efac !important;
}

body.dark-mode .workflow-steps,
body.dark-mode .workflow-steps .text-muted,
body.dark-mode .workflow-steps strong {
    color: var(--text-primary);
}
body.dark-mode .workflow-steps .text-muted {
    color: var(--text-muted) !important;
}

body.dark-mode .alert-info {
    background: #0c4a6e;
    border-color: #0284c7;
    color: #e0f2fe;
}
body.dark-mode .alert-success code,
body.dark-mode .alert-light code,
body.dark-mode code {
    color: #6ee7b7;
}

body.dark-mode h6.text-primary {
    color: var(--text-link) !important;
}

body.dark-mode a:not(.btn):not(.nav-link):not(.pc-brand):not(.pc-phone) {
    color: var(--text-link);
}
body.dark-mode .btn-link {
    color: var(--text-link);
}

body.dark-mode .select2-container,
body.dark-mode .form-select option {
    background: var(--bg-input);
    color: var(--text-primary);
}

body.dark-mode .opacity-50 {
    opacity: 0.75 !important;
}

body.dark-mode .variant-price-badge {
    background: var(--primary);
    color: #0f172a;
}

body.dark-mode .security-tip-card {
    background: var(--bg-surface-2);
    border-color: var(--border);
    color: var(--text-primary);
}
body.dark-mode .security-tip-card h6 {
    color: var(--text-link);
}
body.dark-mode .security-tip-card li,
body.dark-mode .security-tip-card p {
    color: var(--text-secondary);
}

/* Loading */
.spinner-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}

.toast-notification {
    position: fixed;
    bottom: 90px; right: 16px;
    z-index: 9998;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    animation: slideIn 0.3s ease;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #d6d3d1; border-radius: 3px; }

.table { font-size: 14px; }
.modal-header:not(.modal-header-brand) {
    background: var(--primary-dark) !important;
    color: var(--text-on-primary) !important;
}
.modal-header:not(.modal-header-brand) .btn-close { filter: invert(1); }
.modal-header-brand { color: #fff; }
.modal-header-brand .btn-close-white { filter: brightness(0) invert(1); }

.color-dot {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.35);
}

.pos-variant-btn {
    border: none;
    border-bottom: 1px solid var(--border) !important;
    color: var(--text-primary);
}

.pos-variant-btn:last-child {
    border-bottom: none !important;
}

.pos-variant-btn:hover,
.pos-variant-btn:focus {
    background: var(--primary-light) !important;
}

.qty-stepper .btn {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 48px;
}
.qty-stepper #qtyInput {
    font-weight: 700;
    font-size: 1.25rem;
}

.variant-price-badge {
    background: linear-gradient(135deg, var(--primary), var(--si-blue));
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 10px;
    white-space: nowrap;
}

/* Hide browser number spinners (^) — use + / − buttons */
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;
}

.stat-card-clickable {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stock-alert-banner {
    border-left: 4px solid var(--danger);
}

@media print {
    .sidebar,
    .mobile-nav,
    .mobile-menu-btn,
    .no-print,
    footer,
    .platform-credit,
    .platform-credit-sidebar,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_paginate,
    .dataTables_wrapper .dataTables_info,
    form.card,
    .alert,
    .top-bar .btn,
    #toggleDarkMode {
        display: none !important;
    }
    #mainContent {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    .print-report-header {
        display: block !important;
        margin-bottom: 1rem;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    @page {
        margin: 12mm;
    }
}
.print-report-header {
    display: none;
}
