/* Variables & Color Palette - Modern Premium Aesthetics */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #f3f4f6;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --success: #10b981;
    --success-light: #d1fae5;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    padding: 0 24px 30px;
    gap: 12px;
}

.logo-container .icon {
    font-size: 28px;
    color: var(--primary);
    background: #eef2ff;
    padding: 8px;
    border-radius: 12px;
}

.logo-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.nav-list {
    list-style: none;
    flex: 1;
}

.nav-list li {
    margin: 4px 16px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 10px;
    transition: var(--transition);
    gap: 14px;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--secondary);
    color: var(--text-main);
}

.nav-link.active {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.nav-link .icon {
    font-size: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.top-header {
    height: 70px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
}

.header-title h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

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

.time-display {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--secondary);
    padding: 8px 16px;
    border-radius: 20px;
}

.user-profile img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
}

/* Views Container */
.views-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    position: relative;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view.active {
    display: block;
}

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

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background-color: #eef2ff;
    color: var(--primary);
}

.stat-icon.income { background-color: var(--success-light); color: var(--success); }
.stat-icon.danger { background-color: var(--danger-light); color: var(--danger); }

.stat-details {
    flex: 1;
    min-width: 0;
}

.stat-details h3 {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    word-break: break-word;
}

/* Tables & Cards */
.table-card {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header, .view-header {
    padding: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.view-header {
    background: transparent;
    padding: 0 0 24px 0;
    border: none;
}

.card-header h2, .view-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background-color: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    font-size: 14px;
    color: var(--text-main);
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

/* UI Elements */
.btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover { background-color: var(--primary-hover); }

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-outline:hover { background-color: var(--secondary); }

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

.btn-icon-only {
    padding: 8px;
    font-size: 18px;
}

.btn-block { width: 100%; }
.btn-lg { padding: 14px; font-size: 16px; }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* POS Layout */
.pos-layout {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 24px;
    height: 100%;
    min-height: 600px;
}

.pos-products-area {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.pos-search {
    position: relative;
    margin: 16px 0 24px;
}

.pos-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 20px;
}

.pos-search input {
    padding-left: 44px;
}

.pos-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    overflow-y: auto;
    padding-right: 8px;
}

.pos-product-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.pos-product-card:hover {
    border-color: var(--primary);
    background-color: #eef2ff;
}

.pos-product-card h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-main);
}

.pos-product-card .price {
    font-weight: 700;
    color: var(--primary);
}

.pos-bill-area {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.bill-header { border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 16px; }
.bill-header p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.bill-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 24px;
}

.bill-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border);
}

.bill-item-details { flex: 1; }
.bill-item-details h4 { font-size: 14px; margin-bottom: 4px; }
.bill-item-details p { font-size: 13px; color: var(--text-muted); }

.bill-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--secondary);
    border-radius: 6px;
    padding: 4px;
}

.qty-btn { border: none; background: white; border-radius: 4px; width: 24px; height: 24px; cursor: pointer; }
.item-total { font-weight: 600; width: 60px; text-align: right; }

.bill-summary {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

/* Subscription Overlay */
.subscription-box {
    max-width: 500px;
}
.subscription-details {
    margin-top: 20px;
    text-align: left;
    font-size: 15px;
    color: var(--text-main);
}
.bank-details-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}
.bank-details-card h4 {
    margin-bottom: 12px;
    color: var(--primary);
    font-size: 16px;
}
.bank-details-card p {
    margin-bottom: 6px;
    font-size: 14px;
}
.package-price {
    background: var(--primary);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    display: inline-block;
    font-weight: 600;
    margin-top: 15px;
}
.status-badge {
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
}
.status-active {
    background: #ecfdf5;
    color: #10b981;
}
.status-pending {
    background: #fffbeb;
    color: #f59e0b;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
}

.summary-row.total {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 24px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-card);
    width: 100%;
    max-width: 440px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: none;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal.active {
    display: block;
    transform: translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }

.modal-body { padding: 24px; }
.modal-footer { padding: 20px 24px; border-top: 1px solid var(--border); }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500; }

/* Text colors */
.text-danger { color: var(--danger); font-weight: 600; }

/* Tabs for Reports */
.tabs-header { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab-btn { background: none; border: none; padding: 12px 24px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; color: var(--text-muted); }
.tab-btn.active { border-bottom-color: var(--primary); color: var(--primary); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Print Styles */
/* Print Styles */
@media print {
    @page { margin: 0; }
    
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        height: auto !important;
    }

    /* Hide the non-printable UI entirely so it takes no space */
    .sidebar, .main-content, .top-header, .auth-overlay, #subscription-overlay {
        display: none !important;
    }

    .app-wrapper {
        display: block !important;
        height: auto !important;
        width: 100% !important;
        overflow: visible !important;
        position: static !important;
    }

    .modal-overlay {
        display: block !important;
        position: static !important;
        background: transparent !important;
        height: auto !important;
        width: 100% !important;
        overflow: visible !important;
    }

    .modal-overlay > .modal:not(#invoice-modal) {
        display: none !important;
    }

    #invoice-modal {
        display: block !important;
        position: static !important;
        transform: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 80mm !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    #invoice-modal .modal-header,
    #invoice-modal .modal-footer,
    #btn-close-invoice-modal {
        display: none !important;
    }

    #print-area {
        display: block !important;
        position: static !important;
        visibility: visible !important;
        width: 80mm !important;
        padding: 5mm !important;
        margin: 0 !important;
        overflow: visible !important;
        font-family: monospace !important;
        font-size: 12px !important;
    }
    
    #print-area * {
        visibility: visible !important;
    }

    .invoice-modern { color: black !important; font-family: monospace !important; }
    
    .invoice-table-container { overflow: visible !important; }
    
    .inv-table { width: 100% !important; border-collapse: collapse !important; margin-block: 10px !important; table-layout: fixed !important; }
    .inv-table th, .inv-table td { 
        text-align: left !important; 
        padding: 4px 0 !important; 
        font-size: 11px !important; 
        word-wrap: break-word !important; 
        color: black !important; 
        border-bottom: 1px dashed #ccc !important;
    }
    .inv-table th:nth-child(1), .inv-table td:nth-child(1) { width: 45% !important; }
    .inv-table th:nth-child(n+2), .inv-table td:nth-child(n+2) { text-align: right !important; width: 18% !important; }
    
    .inv-sum-row { font-size: 12px; width: 100%; justify-content: space-between; display: flex; color: black !important; margin-bottom: 4px !important; }
    .inv-sum-row span:first-child { color: black !important; }
    .inv-sum-grand { display: flex; justify-content: space-between; font-size: 12px; font-weight: bold; width: 100%; color: black !important; margin: 10px 0 !important; border-top: 1px dashed black !important; padding-top: 5px !important; }
}

/* Receipt Display hidden when not printing */
.receipt { font-family: monospace; }
.receipt-header, .receipt-footer { text-align: center; margin-block: 10px; }
.receipt-table { width: 100%; margin-block: 10px; }
.receipt-total { display: flex; justify-content: space-between; font-weight: bold; margin-block: 10px; font-size: 16px; }

/* Authentication UI */
.auth-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-body);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.auth-overlay.active { display: flex; }

.app-wrapper { display: flex; width: 100%; height: 100%; }

.auth-box {
    background: var(--bg-card);
    width: 100%;
    max-width: 400px;
    padding: 32px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.auth-header { text-align: center; margin-bottom: 24px; }
.auth-header h2 { font-size: 22px; color: var(--primary); margin-bottom: 8px; }
.auth-header p { font-size: 14px; color: var(--text-muted); }

.auth-form { display: none; }
.auth-form.active { display: block; animation: fadeIn 0.4s ease forwards; }

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}
.auth-switch span {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}
.auth-switch span:hover { text-decoration: underline; }

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .pos-layout { grid-template-columns: 1fr; }
    .pos-products-area { order: 2; }
    .pos-bill-area { order: 1; }
    .dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

@media (max-width: 768px) {
    /* Sidebar as Mobile Drawer */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        transition: var(--transition);
        z-index: 1000;
        width: 280px;
    }
    .sidebar.show-sidebar {
        left: 0;
        box-shadow: var(--shadow-lg);
    }
    
    /* Overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.active { display: block; }
    
    /* Header Content Update */
    .top-header { padding: 0 16px; justify-content: space-between; gap: 8px; }
    .header-title h1 { font-size: 20px; }
    #mobile-menu-btn { display: block !important; }
    
    .header-right { gap: 8px; }
    #btn-create-marketplace { padding: 8px; font-size: 0; flex-shrink: 0; }
    #btn-create-marketplace i { font-size: 18px; margin: 0; }
    .time-display { display: none; }
    #business-name-display { display: none; }
    #btn-logout { margin-left: 0; }
    
    /* View Contains */
    .views-container { padding: 16px; }
    .view-header { flex-direction: column; align-items: flex-start; gap: 16px; }
    .view-header > div { width: 100%; flex-direction: column; align-items: stretch; gap: 10px; }
    .header-actions { flex-direction: column; width: 100%; gap: 10px; }
    .header-actions .form-control, .header-actions .btn { width: 100%; }
    
    /* Table Settings */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table th, .data-table td { padding: 12px 16px; white-space: nowrap; }
    
    /* Grid Sizes */
    .dashboard-grid { grid-template-columns: 1fr; gap: 16px; }
    .stat-card { padding: 16px; }
    
    /* Auth Form Sizes */
    .auth-box { margin: 16px; padding: 24px; width: calc(100% - 32px); }
    
    /* Setup Modal width */
    .modal { margin: 16px; width: calc(100% - 32px); max-width: none; }
}

/* Premium Dashboard */
.premium-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.premium-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.premium-card h3 { font-size: 16px; color: var(--text-main); font-weight: 600; }
.premium-card .stat-value { font-size: 24px; font-weight: 700; color: #1e293b; }
.premium-card.sales { border-left: 6px solid #0891b2; }
.premium-card.profit { border-left: 6px solid #10b981; }
.premium-card.flow { border-left: 6px solid #6366f1; }
.premium-card.purchases { border-left: 6px solid #f59e0b; }
.premium-card.expenses { border-left: 6px solid #ef4444; }
.premium-card.monthly { border-left: 6px solid #06b6d4; }

.stat-badge-group { display: flex; flex-direction: column; gap: 8px; margin-top: 15px; }
.stat-badge {
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.dashboard-charts {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-top: 24px;
}
.chart-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.chart-body { min-height: 250px; position: relative; }

.gauge-container { display: flex; align-items: center; justify-content: center; position: relative; }
.gauge-center {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
}
#target-percentage { font-size: 28px; font-weight: 700; color: #0ea5e9; }
#target-value { font-size: 14px; color: var(--text-muted); }
.target-footer { display: flex; gap: 10px; margin-top: 20px; }

/* Large Product Modal Grid */
.product-modal-large { max-width: 800px !important; }
.product-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}
.full-width { grid-column: span 2; }
.form-group-with-icon {
    position: relative;
}
.form-group-with-icon i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
}
.form-group-with-icon .form-control {
    padding-left: 40px;
}
.form-row-multi { display: flex; gap: 10px; align-items: center; }
.flex-1 { flex: 1; }
.btn-input-add {
    background: #e2e8f0;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: var(--transition);
}
.btn-input-add:hover { background: #cbd5e1; }

.image-upload-dashed {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #f8fafc;
}
.image-upload-dashed:hover { border-color: var(--primary); background: #f1f5f9; }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-muted); }

.checkbox-row { display: flex; flex-wrap: wrap; gap: 15px; padding: 10px 0; }
.cb-label { font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.cb-label input { width: 16px; height: 16px; }

/* Reports Enhancements */
.report-filters-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}
.filter-grid { display: flex; flex-wrap: wrap; gap: 15px; align-items: flex-end; }
.report-chart-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    height: 350px; /* Fixed height for chart stability */
}
.report-chart-card h3 { margin-bottom: 15px; }
#reportChart { height: 260px !important; }
.report-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 24px;
}
.summary-box {
    background: #0d5c63;
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}
.summary-box p { font-size: 13px; opacity: 0.8; margin-bottom: 5px; }
.summary-box h4 { font-size: 20px; font-weight: 700; }

/* POS Billing Columns */
.bill-items-header {
    display: grid;
    grid-template-columns: 2fr 0.6fr 0.8fr 1fr;
    padding: 10px 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}
.pos-bill-item {
    display: grid;
    grid-template-columns: 2fr 0.6fr 0.8fr 1fr;
    padding: 12px 0;
    align-items: center;
    border-bottom: 1px dashed var(--border);
    font-size: 13px;
}
.pos-bill-item .qty-control { gap: 4px; }
.col-product { word-break: break-word; }
.col-total { text-align: right; font-weight: 600; }

/* Modern Invoice Styling */
.invoice-modern {
    color: #1e293b;
    font-family: 'Inter', sans-serif;
}
.invoice-top-details { display: flex; justify-content: flex-end; margin-bottom: 30px; }
.invoice-info-side p { margin-bottom: 4px; font-size: 14px; text-align: right; }
.invoice-info-side p strong { color: var(--text-muted); }
.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 30px; }
.inv-table th { text-align: left; padding: 12px 0; border-bottom: 2px solid #f1f5f9; color: #0fa4b5; font-size: 14px; font-weight: 600; }
.inv-table td { padding: 12px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.inv-table th:nth-child(n+2), .inv-table td:nth-child(n+2) { text-align: right; }
.invoice-summary-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.inv-sum-row { display: flex; gap: 40px; font-size: 14px; }
.inv-sum-row span:first-child { color: var(--text-muted); font-weight: 500; }
.inv-sum-grand {
    display: flex;
    gap: 40px;
    font-size: 14px;
    font-weight: 700;
    color: #475569;
    margin: 15px 0;
}
/* Prevent Horizontal Scroll Globally */
html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

.app-wrapper {
    overflow-x: hidden;
    width: 100%;
}

/* Mobile Responsiveness Improvements */
@media (max-width: 992px) {
    :root {
        --sidebar-width: 260px;
    }

    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-width));
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: var(--transition);
        box-shadow: none;
    }

    .sidebar.active {
        left: 0;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }

    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 15px; /* Match header padding */
        padding-top: 80px; /* Header space */
        width: 100%;
        overflow-x: hidden;
    }

    .top-header {
        position: fixed;
        left: 0; right: 0; top: 0;
        z-index: 900;
        padding: 0 15px; /* Match content padding */
        height: 70px;
        margin-left: 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: var(--bg-card);
    }

    #mobile-menu-btn {
        display: block !important;
    }

    /* Dashboard Grid Selector Fixes */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .dashboard-charts {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    /* POS Stacking */
    .pos-grid {
        grid-template-columns: 1fr !important;
        height: auto !important;
        gap: 20px;
    }

    .products-column {
        height: auto;
        min-height: 500px;
    }

    .bill-column {
        position: relative;
        height: auto;
        min-height: 600px;
        order: 2;
    }

    /* Inventory & Tables */
    .view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
    }

    .search-box {
        width: 100% !important;
    }

    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px; /* Adjust for better fit on small screens */
    }

    /* Modal Adjustments */
    .modal {
        width: 92% !important;
        margin: 4% auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .product-form-grid {
        grid-template-columns: 1fr !important;
    }

    .full-width {
        grid-column: span 1 !important;
    }

    .header-right {
        gap: 8px;
    }

    .time-display, #business-name-display {
        display: none;
    }
}

@media (max-width: 600px) {
    .header-right .btn-outline {
        padding: 6px;
    }
    .header-right .btn-outline i { margin: 0; }
    .header-right .btn-outline span { display: none; }
    
    .invoice-top-details { flex-direction: column; align-items: center; }
    .invoice-info-side p { text-align: center; }

    .auth-box {
        width: 92%;
        max-width: 380px;
        padding: 20px;
    }

    .subscription-box {
        width: 95%;
        max-width: 420px;
        padding: 15px;
    }
}
