/* ============================================================
   PBC POS SYSTEM - Main Stylesheet
   Designed by Vilign | vilign.net
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Noto+Nastaliq+Urdu:wght@400;500;600;700&display=swap');

/* ── CSS Variables - Light Theme ─────────────────────────── */
:root {
    --primary:        #1a56db;
    --primary-dark:   #1241b5;
    --primary-light:  #e8effd;
    --accent:         #0ea271;
    --accent-dark:    #097a56;
    --accent-light:   #d1fae5;
    --danger:         #e3342f;
    --warning:        #f6993f;
    --info:           #6574cd;

    --bg-body:        #f0f4f9;
    --bg-card:        #ffffff;
    --bg-sidebar:     #0f1724;
    --bg-sidebar-hover: rgba(255,255,255,0.08);
    --bg-header:      #ffffff;
    --bg-input:       #ffffff;
    --bg-table-head:  #f8faff;
    --bg-table-row:   #ffffff;
    --bg-table-alt:   #f8faff;

    --text-primary:   #0d1526;
    --text-secondary: #64748b;
    --text-muted:     #94a3b8;
    --text-sidebar:   #c8d3e0;
    --text-sidebar-active: #ffffff;

    --border:         #e2e8f0;
    --border-focus:   #1a56db;
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.06);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg:      0 8px 32px rgba(0,0,0,0.12);
    --shadow-card:    0 2px 12px rgba(26,86,219,0.06);

    --sidebar-width:  260px;
    --header-height:  64px;
    --radius-sm:      6px;
    --radius-md:      10px;
    --radius-lg:      16px;
    --radius-xl:      24px;

    --font-main:      'Plus Jakarta Sans', sans-serif;
    --font-urdu:      'Noto Nastaliq Urdu', serif;

    --transition:     all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Dark Theme ─────────────────────────────────────────── */
[data-theme="dark"] {
    --bg-body:        #2f3649;
    --bg-card:        #151c2c;
    --bg-sidebar:     #0a0d18;
    --bg-sidebar-hover: rgba(255,255,255,0.06);
    --bg-header:      #111827;
    --bg-input:       #1e2a3d;
    --bg-table-head:  #1a2438;
    --bg-table-row:   #151c2c;
    --bg-table-alt:   #1a2438;

    --text-primary:   #e8f0fe;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;

    --border:         #1e2d45;
    --border-focus:   #3b82f6;
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.3);
    --shadow-md:      0 4px 16px rgba(0,0,0,0.4);
    --shadow-card:    0 2px 12px rgba(0,0,0,0.3);

    --primary-light:  rgba(26,86,219,0.15);
    --accent-light:   rgba(14,162,113,0.15);
}

/* ── RTL Support ─────────────────────────────────────────── */
[dir="rtl"] {
    font-family: var(--font-urdu);
    letter-spacing: 0;
}
[dir="rtl"] .sidebar        { right: 0; left: auto; }
[dir="rtl"] .main-content   { margin-right: var(--sidebar-width); margin-left: 0; }
[dir="rtl"] .ms-auto         { margin-right: auto !important; margin-left: 0 !important; }
[dir="rtl"] .me-2            { margin-left: 0.5rem !important; margin-right: 0 !important; }
[dir="rtl"] .text-end        { text-align: left !important; }
[dir="rtl"] .nav-icon        { margin-left: 12px; margin-right: 0; }

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.sidebar-brand img { width: 38px; height: 38px; object-fit: contain; }
.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}
.sidebar-brand-tag {
    font-size: 0.65rem;
    color: var(--text-sidebar);
    opacity: 0.6;
    letter-spacing: 0.05em;
}

.sidebar-section {
    padding: 20px 0 6px;
}
.sidebar-section-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(200,211,224,0.4);
    padding: 0 20px 8px;
}
.nav-item { display: block; position: relative; }
.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: var(--text-sidebar);
    border-radius: 0;
    transition: var(--transition);
    font-size: 0.84rem;
    font-weight: 500;
    gap: 0;
    white-space: nowrap;
}
.nav-link:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}
.nav-link.active {
    background: linear-gradient(90deg, rgba(26,86,219,0.3), rgba(26,86,219,0.05));
    color: #fff;
    border-left: 3px solid var(--primary);
}
.nav-icon {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    opacity: 0.75;
    flex-shrink: 0;
    stroke-width: 1.8;
}
.nav-link.active .nav-icon,
.nav-link:hover .nav-icon { opacity: 1; }

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 0.7rem;
    color: rgba(200,211,224,0.3);
}
.sidebar-footer a {
    color: rgba(200,211,224,0.5);
    font-weight: 600;
}
.sidebar-footer a:hover { color: rgba(200,211,224,0.8); }

/* ── Main Content ────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin 0.3s;
}

/* ── Header ─────────────────────────────────────────────── */
.header {
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 500;
    box-shadow: var(--shadow-sm);
}
.header-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}
.header-title span {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 8px;
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.btn-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.btn-icon:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.btn-icon svg { width: 16px; height: 16px; stroke-width: 2; }

.user-menu {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 30px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
}
.user-menu:hover { border-color: var(--primary); }
.user-avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
}
.user-info { display: flex; flex-direction: column; }
.user-name  { font-size: 0.78rem; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.user-role  { font-size: 0.65rem; color: var(--text-muted); line-height: 1.2; }
.user-caret { width: 14px; height: 14px; color: var(--text-muted); stroke-width: 2.5; }

/* ── Page Content ────────────────────────────────────────── */
.page-content {
    padding: 28px;
    flex: 1;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}
.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
}
.card-body { padding: 22px; }
.card-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: var(--bg-table-head);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    transition: var(--transition);
    box-shadow: var(--shadow-card);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
    width: 50px; height: 50px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 24px; height: 24px; stroke-width: 1.8; }
.stat-icon.blue  { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--accent-light);  color: var(--accent); }
.stat-icon.orange{ background: #fff7ed; color: var(--warning); }
.stat-icon.red   { background: #fef2f2; color: var(--danger); }
[data-theme="dark"] .stat-icon.orange { background: rgba(246,153,63,0.12); }
[data-theme="dark"] .stat-icon.red    { background: rgba(227,52,47,0.12); }
.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.03em;
}
.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 3px;
}
.stat-change {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 4px;
}
.stat-change.up   { color: var(--accent); }
.stat-change.down { color: var(--danger); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    line-height: 1;
    white-space: nowrap;
    font-family: var(--font-main);
}
.btn svg { width: 15px; height: 15px; stroke-width: 2.2; flex-shrink: 0; }
.btn-sm { padding: 6px 14px; font-size: 0.77rem; }
.btn-lg { padding: 12px 26px; font-size: 0.9rem; }

.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; box-shadow: 0 4px 12px rgba(26,86,219,0.3); }

.btn-success { background: var(--accent); color: white; border-color: var(--accent); }
.btn-success:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: white; }

.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #c0302b; color: white; }

.btn-outline { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn-outline:hover { background: var(--bg-body); }

.btn-outline-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-body); color: var(--text-primary); }

/* ── Forms ───────────────────────────────────────────────── */
.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}
.form-control, .form-select {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.85rem;
    transition: var(--transition);
    appearance: none;
}
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}
.form-control::placeholder { color: var(--text-muted); }
.form-group { margin-bottom: 18px; }

.input-group {
    display: flex;
    gap: 0;
}
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap{
    position: relative;
    overflow: visible;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    height: 400px;
}

.table-scroll {
    overflow-x: auto;
    overflow-y: auto; /* IMPORTANT */
    height:100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}
thead th {
    background: var(--bg-table-head);
    padding: 14px 10px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody tr {
    background: var(--bg-table-row);
    transition: background 0.15s;
}
tbody tr:nth-child(even) { background: var(--bg-table-alt); }
tbody tr:hover { background: var(--primary-light); }
[data-theme="dark"] tbody tr:hover { background: rgba(26,86,219,0.08); }
tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
table th:first-child { width:25px;text-align:center; }
table th:last-child { width:80px;text-align:center; }
table td:first-child { width:25px;text-align:center; }
table td:last-child { width:80px;text-align:center; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.badge-success { background: var(--accent-light);  color: var(--accent-dark); }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-warning { background: #fff7ed; color: #92400e; }
.badge-danger  { background: #fef2f2; color: #991b1b; }
.badge-info    { background: #ede9fe; color: #5b21b6; }
.badge-muted   { background: var(--bg-body); color: var(--text-muted); }
[data-theme="dark"] .badge-warning { background: rgba(246,153,63,0.15); color: #fbbf24; }
[data-theme="dark"] .badge-danger  { background: rgba(227,52,47,0.15);  color: #f87171; }
[data-theme="dark"] .badge-info    { background: rgba(101,116,205,0.15); color: #a78bfa; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; margin-top: 2px; }
.alert-success { background: var(--accent-light);  color: var(--accent-dark); border: 1px solid #a7f3d0; }
.alert-danger  { background: #fef2f2; color: #991b1b;  border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e;  border: 1px solid #fde68a; }
.alert-info    { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #bfdbfe; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
    backdrop-filter: blur(3px);
}
.modal-backdrop.show { opacity: 1; visibility: visible; }
.modal {
    position:relative;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display:block;
}
.modal-backdrop.show .modal { transform: translateY(0) scale(1); }
.modal-lg { max-width: 820px; }
.modal-xl { max-width: 1100px; }
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}
.modal-title { font-size: 1rem; font-weight: 700; flex: 1; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
}
.modal-close:hover { background: var(--danger); color: white; border-color: var(--danger); }
.modal-close svg { width: 14px; height: 14px; stroke-width: 2.5; }
.modal-body   { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.page-item { list-style: none; }
.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    transition: var(--transition);
    cursor: pointer;
}
.page-link:hover     { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.page-item.active .page-link { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.breadcrumb a   { color: var(--text-secondary); font-weight: 500; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb-sep { color: var(--border); }
.breadcrumb-active { color: var(--text-primary); font-weight: 600; }

/* ── Login Page ──────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1724 0%, #1a2740 50%, #0f1724 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(26,86,219,0.12), transparent 70%);
    top: -200px; right: -100px;
}
.login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14,162,113,0.08), transparent 70%);
    bottom: -100px; left: -100px;
}
.login-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-xl);
    padding: 42px;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(20px);
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
    position: relative;
    z-index: 1;
    animation: fadeUp 0.5s ease forwards;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.login-logo {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo img { width: 90px; margin: 0 auto 12px; }
.login-logo h1 { font-size: 1.7rem; font-weight: 800; color: #000000 !important; }
.login-logo p  { font-size: 1.3rem; color: rgba(0, 0, 0, 0.9) !important; margin-top: 4px; }
.login-card .form-label { color: rgba(0, 0, 0, 0.6) !important; }
.login-card .form-control {
    background: rgba(0, 0, 0, 0.07) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: #000000 !important;
}
.login-card .form-control:focus {
    /* border-color: var(--primary); */
    border-color: black;
    background: rgba(255,255,255,0.1);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.2);
}
.login-card .form-control::placeholder { color: rgba(0, 0, 0, 0.25); }
.login-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(90deg, var(--primary), #2563eb);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: var(--transition);
    letter-spacing: 0.02em;
    font-family: var(--font-main);
}
.login-btn:hover { box-shadow: 0 8px 20px rgba(26,86,219,0.4); transform: translateY(-1px); }

/* ── Invoice Builder ─────────────────────────────────────── */
.invoice-item-row td { vertical-align: top; }
.invoice-item-row td input,
.invoice-item-row td select {
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 10px;
    font-size: 0.8rem;
    width: 100%;
    color: var(--text-primary);
    font-family: var(--font-main);
    transition: var(--transition);
}
.invoice-item-row td input:focus,
.invoice-item-row td select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.08);
}
.invoice-totals {
    background: var(--bg-table-head);
    border-radius: var(--radius-md);
    padding: 20px;
}
.invoice-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.invoice-totals-row.grand {
    border-top: 2px solid var(--primary);
    margin-top: 8px;
    padding-top: 10px;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* ── FBR Status ──────────────────────────────────────────── */
.fbr-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
}
.fbr-pending   { background: #fffbeb; color: #92400e !important; }
.fbr-submitted { background: var(--primary-light); color: var(--primary); }
.fbr-verified  { background: var(--accent-light);  color: var(--accent-dark); }
.fbr-failed    { background: #fef2f2; color: #991b1b !important; }
.fbr-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── Dropdown ────────────────────────────────────────────── */
.dropdown { position: relative;  }
.dropdown-menu {
    position: absolute;
    right: 0; top: calc(100% + 6px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 9999;
    display: none;
    overflow: hidden;
    animation: dropIn 0.15s ease;
}
.dropdown-menu.show { display: block; }
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 16px;
    font-size: 0.83rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s;
}
.dropdown-item:hover { background: var(--bg-body); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: #fef2f2; }
.dropdown-item svg { width: 14px; height: 14px; stroke-width: 2; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Tab ─────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}
.tab-btn {
    padding: 10px 18px;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text-muted);
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    font-family: var(--font-main);
}
.tab-btn:hover   { color: var(--text-primary); }
.tab-btn.active  { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content     { display: none; }
.tab-content.active { display: block; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar     { width: 64px; }
    .sidebar-brand-text,
    .nav-link span,
    .sidebar-section-label,
    .nav-badge,
    .sidebar-footer { display: none; }
    .nav-link    { justify-content: center; padding: 12px; }
    .nav-icon    { margin: 0; }
    .main-content { margin-left: 64px; }
    [dir="rtl"] .main-content { margin-right: 64px; margin-left: 0; }
}

@media (max-width: 768px) {
    .sidebar   { transform: translateX(-100%); width: var(--sidebar-width); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-brand-text, .nav-link span, .sidebar-section-label,
    .nav-badge, .sidebar-footer { display: flex; }
    .nav-link { justify-content: flex-start; padding: 10px 20px; }
    .nav-icon { margin-right: 12px; }
    .main-content { margin-left: 0; }
    .page-content { padding: 16px; }
    .header   { padding: 0 16px; }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    [dir="rtl"] .sidebar.open { transform: translateX(0); }
    [dir="rtl"] .main-content { margin-right: 0; }
}

/* ── Utilities ───────────────────────────────────────────── */
.text-primary   { color: var(--primary) !important; }
.text-success   { color: var(--accent)  !important; }
.text-danger    { color: var(--danger)  !important; }
.text-warning   { color: var(--warning) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-sm        { font-size: 0.8rem; }
.text-xs        { font-size: 0.72rem; }
.fw-bold        { font-weight: 700; }
.fw-semibold    { font-weight: 600; }
.d-flex         { display: flex; }
.align-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-2          { gap: 8px; }
.gap-3          { gap: 12px; }
.gap-4          { gap: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.me-2 { margin-right: 8px; }
.ms-auto { margin-left: auto; }
.w-100 { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
    .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
    .sidebar, .header, .btn, .no-print { display: none !important; }
    .main-content { margin: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ── 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(--text-muted); }

/* ── Loading Spinner ─────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }



/* ─────────────────────────────────────────────────────────────
   PATCH: Add this to the bottom of pos/assets/css/styles.css
   Fixes: 1) dark theme table row text invisible
          2) dropdown z-index behind table rows
          3) dark theme form controls color
───────────────────────────────────────────────────────────── */

/* ── Dark theme: force all text to use CSS variable ───────── */
[data-theme="dark"] body,
[data-theme="dark"] td,
[data-theme="dark"] th,
[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] label,
[data-theme="dark"] div,
[data-theme="dark"] li         { color: var(--text-primary); }

[data-theme="dark"] .text-muted,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .sidebar-section-label,
[data-theme="dark"] .breadcrumb,
[data-theme="dark"] small      { color: var(--text-muted) !important; }

[data-theme="dark"] a          { color: var(--primary); }
[data-theme="dark"] a:hover    { color: var(--primary-dark); }

/* Table rows in dark mode */
[data-theme="dark"] tbody td   { color: var(--text-primary); }
[data-theme="dark"] thead th   { color: var(--text-muted); }

/* Form controls in dark mode */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    color: var(--text-primary);
    background: var(--bg-input);
    border-color: var(--border);
}
[data-theme="dark"] .form-control::placeholder { color: var(--text-muted); }

/* Badges — must stay their own colors, not inherit dark text */
[data-theme="dark"] .badge           { color: inherit; }
[data-theme="dark"] .badge-success   { color: var(--accent-dark) !important; }
[data-theme="dark"] .badge-primary   { color: var(--primary) !important; }

/* Stat card values */
[data-theme="dark"] .stat-value      { color: var(--text-primary); }

/* Card titles */
[data-theme="dark"] .card-title      { color: var(--text-primary); }

/* Header */
[data-theme="dark"] .header-title    { color: var(--text-primary); }
[data-theme="dark"] .user-name       { color: var(--text-primary); }

/* ── Dropdown z-index fix (must be above table rows) ───────── */
.dropdown-menu {
    z-index: 1050;   /* higher than Bootstrap's table stacking context */
}

/* Select2 dropdown z-index (dropdownParent body handles this but just in case) */
.select2-container--open { z-index: 9999; }

/* ── RTL dark theme fix (Urdu font was getting wrong color) ── */
[dir="rtl"],
[dir="rtl"] body,
[dir="rtl"] td,
[dir="rtl"] th,
[dir="rtl"] span,
[dir="rtl"] p,
[dir="rtl"] div,
[dir="rtl"] label  { color: var(--text-primary); }