/* ============================================================
   Real Barber POS – Master Stylesheet v4
   Layout: Padding-Left | Theme: Light / Dark Switcher
   ============================================================ */

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

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s ease, color 0.3s ease;
}

/* ── CSS Variables – Dark Theme (default) ───────────────── */
:root {
    /* Accent */
    --teal:      #34d399;
    --teal-dark: #059669;
    --amber:     #fbbf24;
    --rose:      #fb7185;
    --indigo:    #818cf8;

    /* Layout */
    --sidebar-w: 250px;
    --topbar-h:  60px;
    --radius:    14px;
    --radius-sm: 8px;
    --transition:all 0.22s cubic-bezier(0.4,0,0.2,1);

    /* Dark colours */
    --bg:        #0a0f1a;
    --dark:      #0a0f1a;
    --card:      #111827;
    --card-2:    #1a2235;
    --sidebar-bg:linear-gradient(180deg,#111827 0%,#0d1b2e 100%);
    --topbar-bg: rgba(10,15,26,0.95);
    --input-bg:  rgba(255,255,255,0.04);
    --border:    rgba(255,255,255,0.08);
    --text:      #e2e8f0;
    --text-h:    #f1f5f9;
    --text-sub:  #94a3b8;
    --text-muted:#6b7280;
    --text-dim:  #cbd5e1;
    --shadow:    0 8px 32px rgba(0,0,0,0.4);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --scroll-thumb: rgba(255,255,255,0.1);
}

/* ── Light Theme Variables ───────────────────────────────── */
[data-theme="light"] {
    --bg:        #f0f4f8;
    --dark:      #f0f4f8;
    --card:      #ffffff;
    --card-2:    #f8fafc;
    --sidebar-bg:linear-gradient(180deg,#1e293b 0%,#0f172a 100%);/* sidebar stays dark */
    --topbar-bg: rgba(255,255,255,0.97);
    --input-bg:  rgba(0,0,0,0.03);
    --border:    rgba(0,0,0,0.09);
    --text:      #334155;
    --text-h:    #0f172a;
    --text-sub:  #64748b;
    --text-muted:#94a3b8;
    --text-dim:  #475569;
    --shadow:    0 8px 32px rgba(0,0,0,0.12);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
    --scroll-thumb: rgba(0,0,0,0.15);
}

/* ── Utilities ───────────────────────────────────────────── */
.hidden        { display: none !important; }
.text-center   { text-align: center; }
.text-amber    { color: var(--amber); }
.text-teal     { color: var(--teal); }
.text-rose     { color: var(--rose); }
.mt-4          { margin-top: 1.5rem; }
.py-4          { padding-top: 1rem; padding-bottom: 1rem; }
.p-0           { padding: 0 !important; }

/* ── Auth Layout ─────────────────────────────────────────── */
.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(ellipse at 30% 50%, #0d2137 0%, #0a0f1a 60%);
    padding: 1rem;
}

/* ============================================================
   CORE LAYOUT (v3 – Padding-Left approach, no calc hacks)
   - body.app-body gets padding-left = sidebar width
   - sidebar is position:fixed, creates visual space
   - main-content fills 100% of the padded body (no width calc)
   ============================================================ */

/* App shell – padding-left pushes content right of sidebar */
.app-body {
    padding-left: var(--sidebar-w);
    min-height: 100vh;
    background: #0a0f1a;
}

/* Sidebar – fixed, overlays nothing because body is padded */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: linear-gradient(180deg, #111827 0%, #0d1b2e 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 300;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Main content – natural flow, fills padded body width */
.main-content {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0a0f1a;
}

/* POS special: no scroll on body, fixed-height content */
.pos-layout {
    height: 100vh;
    overflow: hidden;
}
.pos-layout .main-content {
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar Internals ───────────────────────────────────── */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--teal), #0d9488);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
}
.brand-name    { display: block; font-weight: 700; font-size: 0.95rem; color: #f1f5f9; }
.brand-tagline { display: block; font-size: 0.68rem; color: var(--text-muted); letter-spacing: 0.05em; }

.sidebar-nav {
    padding: 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    font-family: inherit;
}
.nav-item:hover  { background: rgba(52,211,153,0.08); color: var(--teal); }
.nav-item.active { background: rgba(52,211,153,0.15); color: var(--teal); font-weight: 600; }
.nav-icon  { font-size: 1.1rem; min-width: 1.4rem; text-align: center; }
.nav-logout:hover { background: rgba(251,113,133,0.1); color: var(--rose); }

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.user-card {
    display: flex; align-items: center; gap: 0.65rem;
    padding: 0.5rem 0.85rem; margin-bottom: 0.25rem;
}
.user-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--teal), #0d9488);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; color: #fff; flex-shrink: 0;
}
.user-name { display: block; font-size: 0.82rem; font-weight: 600; color: #f1f5f9; }
.user-role { display: block; font-size: 0.68rem; font-weight: 500; border-radius: 4px; padding: 1px 6px; width: fit-content; margin-top: 2px; }
.role-admin  { background: rgba(251,191,36,0.15);   color: var(--amber); }
.role-manager{ background: rgba(129,140,248,0.15);  color: var(--indigo); }
.role-cashier{ background: rgba(52,211,153,0.15);   color: var(--teal); }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-h);
    background: rgba(10,15,26,0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 100;
    flex-shrink: 0;
    gap: 1rem;
    width: 100%;
}

.topbar-left  { display: flex; align-items: center; gap: 0.75rem; min-width: 0; flex: 1; }
.topbar-title { font-size: 1rem; font-weight: 600; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.topbar-date  { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.topbar-time  { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.sidebar-toggle { background: none; border: none; color: #94a3b8; font-size: 1.3rem; cursor: pointer; padding: 0.25rem; display: none; }

.topbar-badge {
    background: rgba(251,191,36,0.15);
    border: 1px solid rgba(251,191,36,0.3);
    color: var(--amber);
    border-radius: 20px;
    padding: 0.2rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}
.topbar-badge:hover { background: rgba(251,191,36,0.25); }

/* ── Page Content ────────────────────────────────────────── */
.page-content {
    padding: 1.5rem 1.75rem;
    flex: 1;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title { font-size: 1.6rem; font-weight: 700; color: #f1f5f9; }
.page-sub   { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.15rem; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 0.95rem; font-weight: 600; color: #f1f5f9; }
.card-body      { padding: 1.25rem; }

/* ── KPI Grid ────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.kpi-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.05;
    border-radius: var(--radius);
    pointer-events: none;
}
.kpi-teal::before   { background: var(--teal); }
.kpi-amber::before  { background: var(--amber); }
.kpi-rose::before   { background: var(--rose); }
.kpi-indigo::before { background: var(--indigo); }

.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.kpi-icon  { font-size: 2rem; flex-shrink: 0; text-align: center; min-width: 2.5rem; }
.kpi-body  { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; flex: 1; }
.kpi-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 1.35rem; font-weight: 800; color: #f1f5f9; line-height: 1.2; word-break: break-word; }
.kpi-sub   { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }
.kpi-sub a { color: var(--teal); text-decoration: none; }

/* ── Dashboard 2-col ─────────────────────────────────────── */
.dash-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

/* ── Activity List ───────────────────────────────────────── */
.activity-list { list-style: none; max-height: 340px; overflow-y: auto; }
.activity-item { display: flex; gap: 0.75rem; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border: none; }
.activity-dot  { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); flex-shrink: 0; margin-top: 0.4rem; }
.activity-body p    { font-size: 0.82rem; color: #cbd5e1; line-height: 1.4; }
.activity-body span { font-size: 0.72rem; color: var(--text-muted); }

/* ── Data Tables ─────────────────────────────────────────── */
.table-wrap  { overflow-x: auto; }
.data-table  { width: 100%; border-collapse: collapse; font-size: 0.855rem; }
.data-table thead tr { border-bottom: 1px solid var(--border); }
.data-table th { padding: 0.9rem 1rem; text-align: left; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); white-space: nowrap; }
.data-table td { padding: 0.85rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.04); color: #cbd5e1; vertical-align: middle; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; font-size: 0.8rem; }

/* ── Badges & Status ─────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; }
.badge-teal      { background: rgba(52,211,153,0.12);  color: var(--teal); }
.badge-secondary { background: rgba(148,163,184,0.1);  color: #94a3b8; }
.badge-amber     { background: rgba(251,191,36,0.12);  color: var(--amber); }
.badge-rose      { background: rgba(251,113,133,0.12); color: var(--rose); }
.badge-indigo    { background: rgba(129,140,248,0.12); color: var(--indigo); }

.status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.status-pending   { background: rgba(251,191,36,0.12);  color: var(--amber); }
.status-approved  { background: rgba(52,211,153,0.12);  color: var(--teal); }
.status-cancelled { background: rgba(251,113,133,0.12); color: var(--rose); }
.status-active    { background: rgba(52,211,153,0.12);  color: var(--teal); }
.status-inactive  { background: rgba(148,163,184,0.1);  color: #94a3b8; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}
.btn-primary { background: linear-gradient(135deg, var(--teal), #0d9488); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(52,211,153,0.3); }
.btn-success { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger  { background: linear-gradient(135deg, var(--rose), #e11d48); color: #fff; }
.btn-danger:hover  { opacity: 0.85; }
.btn-warning { background: linear-gradient(135deg, var(--amber), #d97706); color: #000; }
.btn-warning:hover { opacity: 0.9; }
.btn-ghost {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: #94a3b8;
}
.btn-ghost:hover { background: rgba(255,255,255,0.1); color: #f1f5f9; }
.btn-block { width: 100%; justify-content: center; }
.btn-lg    { padding: 0.8rem 1.5rem; font-size: 1rem; }
.btn-sm    { padding: 0.3rem 0.75rem; font-size: 0.78rem; }
.btn-xs    { padding: 0.2rem 0.55rem; font-size: 0.72rem; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
}
.alert-success { background: rgba(52,211,153,0.1);  border: 1px solid rgba(52,211,153,0.3);  color: var(--teal); }
.alert-danger  { background: rgba(251,113,133,0.1); border: 1px solid rgba(251,113,133,0.3); color: var(--rose); }
.alert-warning { background: rgba(251,191,36,0.1);  border: 1px solid rgba(251,191,36,0.3);  color: var(--amber); }
.alert-info    { background: rgba(129,140,248,0.1); border: 1px solid rgba(129,140,248,0.3); color: var(--indigo); }
.alert-dismissible button { background: none; border: none; color: inherit; font-size: 1.2rem; cursor: pointer; margin-left: auto; }

/* ── Auth ────────────────────────────────────────────────── */
.auth-wrapper { width: 100%; max-width: 420px; }
.auth-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo .logo-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.auth-logo h1 { font-size: 1.5rem; font-weight: 800; color: #f1f5f9; }
.auth-logo p  { color: var(--text-muted); font-size: 0.875rem; }
.auth-form    { display: flex; flex-direction: column; gap: 1rem; }
.auth-hint    { text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 1.25rem; }
.auth-hint code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.8rem; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; }

.form-group input,
.form-group select,
.form-group textarea {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #e2e8f0;
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.65rem 0.9rem;
    width: 100%;
    transition: var(--transition);
    outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--teal);
    background: rgba(52,211,153,0.04);
    box-shadow: 0 0 0 3px rgba(52,211,153,0.1);
}
.form-group select option { background: var(--card); color: #e2e8f0; }

.input-icon-wrap { position: relative; display: flex; align-items: center; }
.input-icon-wrap input { padding-left: 2.5rem; }
.input-icon   { position: absolute; left: 0.9rem; font-size: 1rem; pointer-events: none; color: var(--text-muted); }
.toggle-pwd   { position: absolute; right: 0.9rem; background: none; border: none; cursor: pointer; font-size: 1rem; color: var(--text-muted); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-full { grid-column: 1 / -1; }
.form-row  { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }

/* ── POS Layout ──────────────────────────────────────────── */
.pos-wrapper {
    display: grid;
    grid-template-columns: 1fr 385px;
    height: calc(100vh - var(--topbar-h));
    overflow: hidden;
}

.pos-catalog {
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-right: 1px solid var(--border);
    min-width: 0;
}

.pos-search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
}
.pos-search-bar input {
    background: none; border: none; outline: none;
    color: #e2e8f0; font-family: inherit; font-size: 0.9rem; flex: 1;
}

.catalog-tabs { display: flex; gap: 0.5rem; }
.tab-btn {
    flex: 1; padding: 0.55rem; border: 1px solid var(--border);
    background: transparent; border-radius: var(--radius-sm);
    color: #94a3b8; font-family: inherit; font-weight: 600;
    font-size: 0.82rem; cursor: pointer; transition: var(--transition);
}
.tab-btn.active { background: rgba(52,211,153,0.12); border-color: rgba(52,211,153,0.3); color: var(--teal); }

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 0.75rem;
}

.catalog-item {
    background: var(--card-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    user-select: none;
}
.catalog-item:hover:not(.out-of-stock) { border-color: var(--teal); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(52,211,153,0.15); }
.catalog-item:active:not(.out-of-stock) { transform: scale(0.97); }
.catalog-item.out-of-stock { opacity: 0.4; cursor: not-allowed; }

.item-emoji { font-size: 1.6rem; margin-bottom: 0.4rem; }
.item-name  { font-size: 0.8rem; font-weight: 600; color: #f1f5f9; margin-bottom: 0.3rem; }
.item-price { font-size: 0.82rem; color: var(--teal); font-weight: 700; }
.item-stock { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.2rem; }
.item-stock.low { color: var(--amber); }
.empty-catalog { color: var(--text-muted); font-size: 0.875rem; padding: 1rem; }
.empty-catalog a { color: var(--teal); }

/* ── Cart Panel ──────────────────────────────────────────── */
.pos-cart-panel {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border-left: 1px solid var(--border);
    height: 100%;
    overflow: hidden;
}
.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.95rem;
    flex-shrink: 0;
}
.cart-section { padding: 0.7rem 1.15rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cart-section label { display: block; font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.35rem; }
.cart-section select,
.cart-section textarea {
    width: 100%; background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: #e2e8f0; font-family: inherit;
    font-size: 0.85rem; padding: 0.5rem 0.75rem; outline: none; transition: var(--transition);
}
.cart-section select:focus, .cart-section textarea:focus { border-color: var(--teal); }
.cart-section select option { background: var(--card); }
.loyalty-info { font-size: 0.72rem; color: var(--amber); margin-top: 0.35rem; }

.cart-items { flex: 1; overflow-y: auto; padding: 0.5rem 1.15rem; }
.cart-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.4rem; padding: 2rem; color: var(--text-muted); font-size: 0.85rem; text-align: center; height: 100%;
}
.cart-empty span { font-size: 2rem; }

.cart-row { border-bottom: 1px solid rgba(255,255,255,0.04); padding: 0.6rem 0; }
.cart-row-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.35rem; }
.cart-row-name  { font-size: 0.83rem; font-weight: 600; color: #e2e8f0; }
.cart-row-price { font-size: 0.85rem; font-weight: 700; color: var(--teal); }
.cart-row-controls { display: flex; align-items: center; gap: 0.4rem; }
.cart-row-controls button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); background: rgba(255,255,255,0.05); color: #f1f5f9; font-size: 1rem; cursor: pointer; transition: var(--transition); display: flex; align-items: center; justify-content: center; }
.cart-row-controls button:hover { background: rgba(52,211,153,0.1); border-color: var(--teal); color: var(--teal); }
.cart-row-controls span { width: 24px; text-align: center; font-weight: 700; font-size: 0.85rem; }
.remove-btn { color: var(--rose) !important; border-color: rgba(251,113,133,0.3) !important; }
.remove-btn:hover { background: rgba(251,113,133,0.1) !important; }

/* ── Cart Totals ─────────────────────────────────────────── */
.cart-totals { padding: 0.75rem 1.15rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.total-row { display: flex; justify-content: space-between; align-items: center; padding: 0.3rem 0; font-size: 0.85rem; }
.total-row span:first-child { color: var(--text-muted); }
.total-input { background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: 6px; color: #e2e8f0; font-family: inherit; font-size: 0.85rem; padding: 0.25rem 0.5rem; width: 90px; text-align: right; outline: none; }
.total-input:focus { border-color: var(--teal); }
.total-final { padding-top: 0.5rem; border-top: 1px solid var(--border); margin-top: 0.25rem; }
.total-final span { font-size: 1rem; font-weight: 800; color: #f1f5f9; }
.total-final span:last-child { color: var(--teal); font-size: 1.15rem; }
.loyalty-row   { color: var(--amber) !important; }
.loyalty-label { color: var(--amber) !important; }
.loyalty-value { font-weight: 700; color: var(--amber) !important; }

/* ── Payment Methods ─────────────────────────────────────── */
.payment-methods { display: flex; gap: 0.5rem; }
.pm-option {
    flex: 1; display: flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.65rem; border: 1px solid var(--border);
    border-radius: 6px; font-size: 0.8rem; font-weight: 600;
    cursor: pointer; transition: var(--transition); color: #94a3b8;
}
.pm-option input { accent-color: var(--teal); width: 14px; height: 14px; }
.pm-option:has(input:checked) { border-color: var(--teal); color: var(--teal); background: rgba(52,211,153,0.08); }
.checkout-hint { text-align: center; font-size: 0.72rem; color: var(--text-muted); padding: 0.5rem 1.15rem; flex-shrink: 0; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.75); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.modal-box {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 2.5rem; text-align: center; max-width: 400px; width: 90%; box-shadow: var(--shadow);
}
.modal-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.modal-box h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.5rem; }
.modal-box p  { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ── Approval Queue ──────────────────────────────────────── */
.approval-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.25rem; }
.approval-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.approval-card-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); background: rgba(251,191,36,0.04); }
.invoice-no   { font-family: monospace; font-size: 0.85rem; color: var(--amber); font-weight: 700; }
.approval-card-body { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.approval-detail { display: flex; justify-content: space-between; font-size: 0.82rem; }
.approval-detail span { color: var(--text-muted); }
.approval-detail strong { color: #e2e8f0; }
.approval-amount { text-align: right; padding: 0.5rem 0; border-top: 1px solid var(--border); margin-top: 0.25rem; }
.approval-amount span { font-size: 0.75rem; color: var(--text-muted); display: block; }
.amount-total { font-size: 1.4rem; font-weight: 800; color: var(--teal); }
.approval-notes { font-size: 0.78rem; color: var(--text-muted); font-style: italic; background: rgba(255,255,255,0.03); padding: 0.5rem; border-radius: 6px; }
.line-items-preview { border-top: 1px solid var(--border); padding-top: 0.5rem; margin-top: 0.25rem; }
.line-item { display: flex; justify-content: space-between; font-size: 0.78rem; color: #94a3b8; padding: 0.15rem 0; }
.approval-card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border); background: rgba(255,255,255,0.02); }
.approval-actions { display: flex; gap: 0.5rem; }

/* ── Products Page ───────────────────────────────────────── */
.products-layout { display: grid; grid-template-columns: 360px 1fr; gap: 1.25rem; align-items: start; }
.products-form-card { position: sticky; top: calc(var(--topbar-h) + 1rem); }

/* ── GRN Page ────────────────────────────────────────────── */
.grn-layout { display: grid; grid-template-columns: 380px 1fr; gap: 1.25rem; align-items: start; }
.grn-form-card { position: sticky; top: calc(var(--topbar-h) + 1rem); }
.log-action { max-width: 400px; word-break: break-word; font-size: 0.8rem; }

/* ── Customers Page ──────────────────────────────────────── */
.customers-layout { display: grid; grid-template-columns: 360px 1fr; gap: 1.25rem; align-items: start; }
.customer-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.25rem; display: flex; align-items: center; gap: 1rem;
    transition: var(--transition); cursor: pointer;
}
.customer-card:hover { border-color: rgba(52,211,153,0.3); background: rgba(52,211,153,0.03); }
.customer-avatar-lg {
    width: 48px; height: 48px; border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), #0d9488);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem; color: #fff; flex-shrink: 0;
}
.customer-info { flex: 1; min-width: 0; }
.customer-name { font-weight: 700; color: #f1f5f9; font-size: 0.95rem; }
.customer-phone { font-size: 0.78rem; color: var(--text-muted); }
.customer-points { font-size: 0.75rem; color: var(--amber); font-weight: 600; }

/* ── Reports ─────────────────────────────────────────────── */
.reports-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; margin-bottom: 1.5rem; }
.reports-stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center; }
.reports-stat-value { font-size: 2rem; font-weight: 800; color: #f1f5f9; margin: 0.5rem 0; }
.reports-stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.date-filter { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.25rem; }
.date-filter label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--text-muted); }
.date-filter input[type=date] {
    background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: #e2e8f0; font-family: inherit;
    font-size: 0.875rem; padding: 0.45rem 0.75rem; outline: none; color-scheme: dark;
}
.date-filter input[type=date]:focus { border-color: var(--teal); }

/* ── Activity Log ────────────────────────────────────────── */
.log-user { font-weight: 600; color: #f1f5f9; }
.log-action-text { color: #94a3b8; font-size: 0.82rem; max-width: 400px; word-break: break-word; }
.log-ip { font-size: 0.72rem; color: var(--text-muted); font-family: monospace; }

/* ── Users Page ──────────────────────────────────────────── */
.users-layout { display: grid; grid-template-columns: 380px 1fr; gap: 1.5rem; align-items: start; }
.users-form-card { position: sticky; top: calc(var(--topbar-h) + 1rem); }

/* ── User Avatar ─────────────────────────────────────────── */
.user-item-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), #0d9488);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem; color: #fff; flex-shrink: 0;
}
.user-item-info { flex: 1; min-width: 0; }
.user-item-name { font-weight: 600; color: #f1f5f9; font-size: 0.9rem; }
.user-item-username { font-size: 0.75rem; color: var(--text-muted); }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 4rem 2rem; }
.empty-icon  { font-size: 3.5rem; display: block; margin-bottom: 1rem; }
.empty-state h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.5rem; color: #f1f5f9; }
.empty-state p  { color: var(--text-muted); }

/* ── Filter Bar ──────────────────────────────────────────── */
.filter-bar  { margin-bottom: 1.25rem; }
.filter-form { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.filter-form input,
.filter-form select {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: #e2e8f0; font-family: inherit;
    font-size: 0.875rem; padding: 0.5rem 0.85rem;
    outline: none; transition: var(--transition);
}
.filter-form input:focus, .filter-form select:focus { border-color: var(--teal); }
.filter-form select option { background: var(--card); }

/* ── Pagination ──────────────────────────────────────────── */
.pagination  { display: flex; gap: 0.35rem; margin-top: 1.25rem; flex-wrap: wrap; }
.page-btn    { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; color: #94a3b8; font-size: 0.85rem; text-decoration: none; transition: var(--transition); }
.page-btn:hover  { border-color: var(--teal); color: var(--teal); }
.page-btn.active { background: rgba(52,211,153,0.12); border-color: rgba(52,211,153,0.3); color: var(--teal); font-weight: 700; }

.text-link { color: var(--teal); font-size: 0.82rem; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* ── Invoice Document ────────────────────────────────────── */
.invoice-doc { max-width: 820px; margin: 0 auto; }
.invoice-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 2rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 1.5rem; }
.invoice-brand { display: flex; align-items: center; gap: 1rem; }
.invoice-brand h1 { font-size: 1.4rem; font-weight: 800; color: #f1f5f9; }
.invoice-brand p  { color: var(--text-muted); font-size: 0.85rem; }
.invoice-meta h2  { font-size: 1.5rem; font-weight: 800; letter-spacing: 0.1em; color: var(--teal); margin-bottom: 0.75rem; }
.invoice-meta-table { font-size: 0.82rem; }
.invoice-meta-table th { padding-right: 1rem; color: var(--text-muted); font-weight: 500; text-align: right; }
.invoice-meta-table td { color: #e2e8f0; font-weight: 600; }
.invoice-parties { display: flex; gap: 3rem; padding: 1.5rem 2rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.invoice-parties h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 0.4rem; }
.invoice-party-name { font-size: 1.05rem; font-weight: 700; color: #f1f5f9; }
.invoice-items-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.invoice-items-table th { padding: 0.75rem 1.5rem; text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.invoice-items-table td { padding: 0.75rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.04); color: #cbd5e1; }
.invoice-totals { display: flex; justify-content: flex-end; padding: 1.5rem 2rem; }
.totals-table { font-size: 0.875rem; }
.totals-table th { padding: 0.35rem 1rem 0.35rem 0; color: var(--text-muted); font-weight: 500; text-align: right; }
.totals-table td { padding: 0.35rem 0; text-align: right; font-weight: 600; color: #e2e8f0; }
.total-final-row th, .total-final-row td { font-size: 1.1rem; font-weight: 800; color: #f1f5f9; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.total-final-row td { color: var(--teal); font-size: 1.2rem; }
.invoice-notes { padding: 1rem 2rem; font-size: 0.85rem; color: var(--text-muted); border-top: 1px solid var(--border); }
.invoice-footer { text-align: center; padding: 1.5rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.85rem; }
.invoice-footer-sub { font-size: 0.72rem; margin-top: 0.25rem; }

/* ── Progress / Strength Bars ────────────────────────────── */
.strength-bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 0.35rem; }
.strength-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease, background 0.3s ease; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1400px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1200px) {
    .reports-grid { grid-template-columns: repeat(2, 1fr); }
    .products-layout,
    .grn-layout,
    .users-layout,
    .customers-layout { grid-template-columns: 1fr; }
    .products-form-card,
    .grn-form-card,
    .users-form-card { position: static; }
}
@media (max-width: 1024px) {
    .dash-grid-2 { grid-template-columns: 1fr; }
    .pos-wrapper  { grid-template-columns: 1fr; height: auto; }
    .pos-layout   { height: auto; overflow: auto; }
    .pos-layout .main-content { height: auto; overflow: auto; }
    .pos-cart-panel { height: auto; border-left: none; border-top: 1px solid var(--border); }
}
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .app-body { padding-left: 0; }
    .sidebar { transform: translateX(-250px); transition: transform 0.3s ease; width: 250px !important; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .page-content { padding: 1rem; }
    .reports-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .filter-form { flex-direction: column; }
    .topbar-date { display: none; }
}

/* ── Light Theme Element Overrides ───────────────────────── */
[data-theme="light"] body,
[data-theme="light"] .app-body       { background: var(--bg); }
[data-theme="light"] .main-content   { background: var(--bg); }

/* Cards */
[data-theme="light"] .card           { background: var(--card); border-color: var(--border); box-shadow: var(--shadow-sm); }
[data-theme="light"] .kpi-card       { background: var(--card); border-color: var(--border); }
[data-theme="light"] .catalog-item   { background: var(--card-2); border-color: var(--border); }
[data-theme="light"] .pos-cart-panel { background: var(--card); }
[data-theme="light"] .approval-card  { background: var(--card); border-color: var(--border); }

/* Topbar */
[data-theme="light"] .topbar {
    background: var(--topbar-bg);
    border-bottom-color: var(--border);
    box-shadow: 0 1px 0 var(--border);
}
[data-theme="light"] .topbar-title  { color: var(--text-h); }
[data-theme="light"] .topbar-date,
[data-theme="light"] .topbar-time   { color: var(--text-muted); }

/* Typography */
[data-theme="light"] .page-title    { color: var(--text-h); }
[data-theme="light"] .page-sub      { color: var(--text-muted); }
[data-theme="light"] .card-header h3 { color: var(--text-h); }
[data-theme="light"] .kpi-value     { color: var(--text-h); }
[data-theme="light"] .kpi-label     { color: var(--text-muted); }
[data-theme="light"] .kpi-sub       { color: var(--text-muted); }
[data-theme="light"] .item-name     { color: var(--text-h); }
[data-theme="light"] .brand-name    { color: #f1f5f9; } /* keep light on dark sidebar */
[data-theme="light"] .cart-row-name { color: var(--text-h); }

/* Tables */
[data-theme="light"] .data-table th  { color: var(--text-muted); }
[data-theme="light"] .data-table td  { color: var(--text-dim); border-bottom-color: var(--border); }
[data-theme="light"] .data-table tbody tr:hover { background: rgba(0,0,0,0.02); }
[data-theme="light"] .data-table code { background: rgba(0,0,0,0.06); color: var(--text-h); }

/* Forms & inputs */
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea,
[data-theme="light"] .cart-section select,
[data-theme="light"] .cart-section textarea,
[data-theme="light"] .filter-form input,
[data-theme="light"] .filter-form select,
[data-theme="light"] .total-input,
[data-theme="light"] .pos-search-bar {
    background: var(--input-bg);
    border-color: var(--border);
    color: var(--text);
}
[data-theme="light"] .pos-search-bar input { color: var(--text); }
[data-theme="light"] .form-group input::placeholder,
[data-theme="light"] .pos-search-bar input::placeholder { color: var(--text-muted); }
[data-theme="light"] .form-group label { color: var(--text-sub); }
[data-theme="light"] .cart-section label { color: var(--text-muted); }

/* Buttons */
[data-theme="light"] .btn-ghost {
    background: rgba(0,0,0,0.04);
    border-color: var(--border);
    color: var(--text-sub);
}
[data-theme="light"] .btn-ghost:hover { background: rgba(0,0,0,0.08); color: var(--text-h); }

/* Activity list */
[data-theme="light"] .activity-item  { border-bottom-color: var(--border); }
[data-theme="light"] .activity-body p { color: var(--text-dim); }
[data-theme="light"] .activity-body span { color: var(--text-muted); }

/* Cart panel */
[data-theme="light"] .cart-header    { border-bottom-color: var(--border); }
[data-theme="light"] .cart-section   { border-bottom-color: var(--border); }
[data-theme="light"] .cart-totals    { border-color: var(--border); }
[data-theme="light"] .cart-row       { border-bottom-color: rgba(0,0,0,0.05); }
[data-theme="light"] .cart-empty     { color: var(--text-muted); }
[data-theme="light"] .total-row span:first-child { color: var(--text-muted); }
[data-theme="light"] .total-final span:first-child { color: var(--text-h); }
[data-theme="light"] .checkout-hint  { color: var(--text-muted); }

/* POS catalog */
[data-theme="light"] .pos-catalog    { border-right-color: var(--border); }
[data-theme="light"] .catalog-item:hover:not(.out-of-stock) { background: #f1fdf8; }
[data-theme="light"] .tab-btn        { border-color: var(--border); color: var(--text-sub); }
[data-theme="light"] .catalog-tabs .tab-btn.active { color: var(--teal); }

/* Page header */
[data-theme="light"] .text-link { color: var(--teal-dark); }

/* Reports stats */
[data-theme="light"] .reports-stat  { background: var(--card); border-color: var(--border); }
[data-theme="light"] .reports-stat-value { color: var(--text-h); }
[data-theme="light"] .reports-stat-label { color: var(--text-muted); }

/* Approval cards */
[data-theme="light"] .approval-card-header { background: rgba(251,191,36,0.06); border-bottom-color: var(--border); }
[data-theme="light"] .approval-card-footer { background: rgba(0,0,0,0.02); border-top-color: var(--border); }
[data-theme="light"] .approval-detail span { color: var(--text-muted); }
[data-theme="light"] .approval-detail strong { color: var(--text); }
[data-theme="light"] .approval-notes { background: rgba(0,0,0,0.03); }

/* Scrollbar – light mode */
[data-theme="light"] ::-webkit-scrollbar-thumb { background: var(--scroll-thumb); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Theme Toggle Button ──────────────────────────────────── */
.theme-toggle {
    width: 38px; height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
    flex-shrink: 0;
    color: var(--text-sub);
    position: relative;
    overflow: hidden;
}
.theme-toggle:hover {
    background: rgba(52,211,153,0.1);
    border-color: rgba(52,211,153,0.3);
    transform: scale(1.05);
}
.theme-toggle .icon-dark,
.theme-toggle .icon-light { transition: all 0.3s ease; position: absolute; }
.theme-toggle .icon-light { opacity: 0; transform: rotate(-90deg) scale(0.5); }
.theme-toggle .icon-dark  { opacity: 1; transform: rotate(0) scale(1); }

[data-theme="light"] .theme-toggle .icon-dark  { opacity: 0; transform: rotate(90deg) scale(0.5); }
[data-theme="light"] .theme-toggle .icon-light { opacity: 1; transform: rotate(0) scale(1); }
