:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --radius: 10px;
    --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* ==========================================
   BUTTONS & BADGES
=========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 13px 24px; font-size: 1rem; }
.btn-block { width: 100%; }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }

.btn-secondary {
    background: #1e293b;
    color: #fff;
}
.btn-secondary:hover { background: #334155; }

.btn-outline {
    background: #fff;
    border-color: var(--border);
    color: var(--text-main);
}
.btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; }

.btn-outline-danger {
    background: transparent;
    border-color: #fecaca;
    color: var(--danger);
}
.btn-outline-danger:hover { background: var(--danger); color: #fff; }

.badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-primary { background: #eef2ff; color: #4f46e5; border: 1px solid #6366f1; }

/* ==========================================
   LANDING PAGE (HOME)
=========================================== */
.public-wrapper {
    min-height: 100vh;
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    color: #fff;
    padding-bottom: 60px;
}

.public-header {
    max-width: 1240px;
    margin: 0 auto;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.35rem;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
}

.badge-pro {
    background: rgba(79, 70, 229, 0.3);
    border: 1px solid #6366f1;
    color: #c7d2fe;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 99px;
}

.public-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}
.public-nav a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.95rem;
}
.public-nav a:hover { color: #fff; }

.hero-section {
    max-width: 1240px;
    margin: 50px auto;
    padding: 0 24px;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 48px;
    align-items: center;
}

.pill-badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.18);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 0.82rem;
    margin-bottom: 18px;
}

.hero-content h1 {
    font-size: 3rem;
    line-height: 1.15;
    margin-bottom: 18px;
    font-weight: 800;
}

.hero-content p {
    color: #94a3b8;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 28px;
}

.hero-actions {
    display: flex;
    gap: 14px;
    margin-bottom: 36px;
}

.hero-stats {
    display: flex;
    gap: 32px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 24px;
}
.hero-stats strong { display: block; font-size: 1.3rem; color: #fff; }
.hero-stats span { font-size: 0.85rem; color: #94a3b8; }

.mockup-window {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.mockup-header {
    background: #0f172a;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.red { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green { background: #10b981; }
.mockup-title { margin-left: 10px; font-size: 0.78rem; color: #64748b; font-family: monospace; }
.mockup-body { padding: 24px; }
.mockup-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.m-card { background: #0f172a; padding: 14px; border-radius: 10px; border: 1px solid #334155; }
.m-card i { color: #818cf8; font-size: 1.2rem; margin-bottom: 8px; }
.m-card h5 { font-size: 0.75rem; color: #94a3b8; }
.m-card p { font-size: 1rem; font-weight: 700; margin-top: 4px; }
.mockup-bar-Visual {
    height: 140px;
    background: #0f172a;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
}
.mockup-bar-Visual .bar {
    width: 14%;
    background: linear-gradient(180deg, #6366f1, #4f46e5);
    border-radius: 6px 6px 0 0;
}

.features-grid {
    max-width: 1240px;
    margin: 40px auto 0;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.feature-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid #334155;
    padding: 28px;
    border-radius: 12px;
}
.feature-card i {
    font-size: 1.6rem;
    color: #818cf8;
    margin-bottom: 14px;
}
.feature-card h3 { margin-bottom: 10px; font-size: 1.15rem; }
.feature-card p { color: #94a3b8; font-size: 0.92rem; line-height: 1.5; }

/* ==========================================
   SOFTWARE SHELL (SIDEBAR & WORKSPACE)
=========================================== */
.software-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.25s ease;
}

.sidebar-brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #1e293b;
}
.sidebar-brand h4 { font-size: 1.05rem; }
.sidebar-brand span { font-size: 0.75rem; color: #94a3b8; }

.nav-section-label {
    padding: 18px 20px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.06em;
}

.sidebar-menu {
    list-style: none;
    padding: 0 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
    transition: all 0.15s;
}
.nav-link i { width: 20px; text-align: center; font-size: 1rem; }
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: var(--primary); color: #fff; }

.nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 99px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid #1e293b;
}

.main-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-header {
    height: 68px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left { display: flex; align-items: center; gap: 14px; }
.header-left h2 { font-size: 1.25rem; font-weight: 700; }

.icon-btn {
    background: #f8fafc;
    border: 1px solid var(--border);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-main);
}

.header-right { display: flex; align-items: center; gap: 14px; }

.live-clock {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 4px 10px 4px 4px;
    border-radius: 99px;
    border: 1px solid var(--border);
}
.user-pill img { width: 34px; height: 34px; border-radius: 50%; }
.user-info strong { display: block; font-size: 0.82rem; }
.user-info small { display: block; font-size: 0.7rem; color: var(--text-muted); }

.content-area {
    padding: 24px;
    flex: 1;
}

.app-view { display: none; }
.app-view.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   SINGLE ADMIN PRIORITY BANNER & STOCK CONTROLS
=========================================== */
.priority-banner {
    background: linear-gradient(90deg, #0f172a, #312e81);
    color: #fff;
    padding: 11px 18px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    box-shadow: var(--shadow);
}

.stock-control-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 3px 6px;
    border-radius: 8px;
}

.stock-btn {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    border: 1px solid #cbd5e1;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.stock-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.action-btn-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ==========================================
   CARDS, TABLES & KPI GRIDS
=========================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 {
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 18px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
}
.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}
.kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.kpi-icon.blue { background: #e0e7ff; color: #4f46e5; }
.kpi-icon.purple { background: #f3e8ff; color: #9333ea; }
.kpi-icon.green { background: #d1fae5; color: #059669; }
.kpi-icon.orange { background: #ffedd5; color: #ea580c; }

.kpi-details span { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }
.kpi-details h3 { font-size: 1.35rem; margin: 4px 0; }
.kpi-details small { font-size: 0.75rem; }

.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }

.dashboard-split {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
}

.split-layout {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 20px;
}

.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.data-table th, .data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
}
.data-table tbody tr:hover { background: #f8fafc; }

/* ==========================================
   POS TERMINAL LAYOUT
=========================================== */
.pos-layout {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 20px;
    align-items: start;
}

.pos-search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 14px;
    max-height: 68vh;
    overflow-y: auto;
    padding-right: 4px;
}

.pos-item-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.pos-item-card:hover {
    border-color: var(--primary);
    box-shadow: 0 6px 14px rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}
.pos-item-top {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.pos-item-card h4 {
    font-size: 0.92rem;
    margin-bottom: 10px;
    color: var(--text-main);
}
.pos-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px dashed var(--border);
    padding-top: 8px;
}
.pos-price { font-weight: 700; color: var(--primary); font-size: 0.95rem; }

.pos-customer-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.pos-cart-items {
    min-height: 250px;
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 14px;
}

.cart-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 6px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.86rem;
}
.cart-qty-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.qty-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #f8fafc;
    cursor: pointer;
    font-weight: 700;
}

.pos-summary {
    background: #f8fafc;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
.summary-row.grand-total {
    font-size: 1.15rem;
    color: var(--primary);
    border-top: 1px solid var(--border);
    padding-top: 10px;
    margin: 10px 0 14px;
}
.discount-input {
    width: 90px !important;
    padding: 4px 8px !important;
    text-align: right;
}

/* ==========================================
   FORMS & CLIENT-SIDE VALIDATION
=========================================== */
.form-group { margin-bottom: 14px; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #334155;
}
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    transition: border 0.15s;
    background: #fff;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
input.input-error, select.input-error, textarea.input-error {
    border-color: var(--danger);
    background: #fef2f2;
}
.error-msg {
    color: var(--danger);
    font-size: 0.75rem;
    display: block;
    margin-top: 4px;
    min-height: 16px;
}

.input-icon { position: relative; }
.input-icon i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}
.input-icon input { padding-left: 36px; }
.flex-1 { flex: 1; }
.filter-bar { display: flex; gap: 12px; }

/* ==========================================
   MODALS, PROFILE & TOAST ALERTS
=========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.modal-card {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    padding: 24px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.modal-close, .modal-close-inline {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
}
.modal-close { position: absolute; top: 16px; right: 18px; }

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.auth-tab {
    padding: 8px;
    border: none;
    background: transparent;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
}
.auth-tab.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }

.profile-card { text-align: center; overflow: hidden; padding-top: 0; }
.profile-banner { height: 90px; background: linear-gradient(90deg, #4f46e5, #7c3aed); margin: 0 -20px; }
.profile-avatar-lg {
    width: 86px;
    height: 86px;
    border-radius: 50%;
    border: 4px solid #fff;
    margin-top: -43px;
    margin-bottom: 10px;
}
.profile-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}
.profile-meta strong { display: block; color: var(--text-muted); }

.support-info-list { display: flex; flex-direction: column; gap: 18px; }
.support-item { display: flex; gap: 14px; align-items: flex-start; }
.support-item i {
    font-size: 1.3rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 12px;
    border-radius: 10px;
}
.support-item h4 { font-size: 0.95rem; margin-bottom: 4px; }
.support-item p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.45; }

.receipt-card { max-width: 380px; font-family: monospace; }
.receipt-header { text-align: center; border-bottom: 1px dashed #94a3b8; padding-bottom: 12px; margin-bottom: 12px; }
.receipt-totals { border-top: 1px dashed #94a3b8; padding-top: 10px; margin-top: 10px; }
.receipt-footer-note { text-align: center; font-size: 0.78rem; color: var(--text-muted); margin: 14px 0; }
.receipt-actions { display: flex; gap: 10px; }

.app-footer {
    padding: 14px 24px;
    background: #fff;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: #0f172a;
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2);
    border-left: 4px solid var(--success);
}
.toast.error { border-left-color: var(--danger); }

.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ==========================================
   CLEAN 1-PAGE THERMAL RECEIPT PRINT FIX
=========================================== */
@media print {
    @page {
        size: auto;
        margin: 8mm;
    }

    body * {
        visibility: hidden !important;
    }

    #receipt-modal,
    #receipt-modal * {
        visibility: visible !important;
    }

    #receipt-modal {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        background: #ffffff !important;
        backdrop-filter: none !important;
        padding: 0 !important;
        margin: 0 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
    }

    .receipt-card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        width: 320px !important;
        max-width: 320px !important;
        padding: 16px !important;
        margin: 0 auto !important;
    }

    /* HIDE PRINT & CLOSE WINDOW BUTTONS ON PAPER */
    .receipt-actions,
    .no-print,
    .toast-container,
    .sidebar,
    .top-header,
    .app-footer,
    .priority-banner {
        display: none !important;
        visibility: hidden !important;
    }
}

/* ==========================================
   RESPONSIVE DESIGN
=========================================== */
@media (max-width: 1024px) {
    .hero-section, .kpi-grid, .dashboard-split, .split-layout, .pos-layout, .features-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: fixed;
        z-index: 900;
        height: 100vh;
        left: 0;
        top: 0;
    }
    .sidebar.collapsed { left: -260px; }
}