:root {
    /* Colors - Lively & Vibrant */
    --bg-body: #f8faff;
    /* Cooler, lighter background */
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;

    --text-primary: #1f2937;
    --text-secondary: #6b7280;

    /* Palette */
    --primary: #4f46e5;
    /* Base Indigo */
    --primary-light: #818cf8;
    --primary-dark: #3730a3;

    --accent: #f97316;
    /* Vibrant Orange */
    --accent-light: #fb923c;
    --accent-dark: #ea580c;

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Gradients */
    --grad-primary: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --grad-accent: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
    --grad-danger: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    --grad-success: linear-gradient(135deg, #34d399 0%, #10b981 100%);

    --border: #e2e8f0;

    /* Shadows (Tinted) */
    --shadow-sm: 0 1px 2px 0 rgba(79, 70, 229, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(79, 70, 229, 0.1), 0 2px 4px -1px rgba(79, 70, 229, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(79, 70, 229, 0.1), 0 4px 6px -2px rgba(79, 70, 229, 0.05);

    /* Layout */
    --sidebar-width: 270px;
    --header-height: 70px;
    --sidebar-height: 80px;
    --radius: 12px;
}

body.dark-mode {
    --bg-body: #111827;
    --bg-sidebar: #1f2937;
    --bg-card: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --border: #374151;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --grad-primary: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Hide Print Area by default on Screen */
#print-area {
    display: none;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.brand {
    height: var(--sidebar-height);
    display: flex;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand-icon {
    display: none;
}

.brand-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-right: 12px;
}

.brand-text {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.nav-menu {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

/* Webkit scrollbar for nav-menu */
.nav-menu::-webkit-scrollbar {
    width: 4px;
}

.nav-menu::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: var(--primary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
    flex-shrink: 0;
}

body.dark-mode .nav-item {
    color: white;
}

body.dark-mode .nav-item {
    color: white;
}

.nav-item:hover {
    background-color: var(--primary);
    color: white;
}

.nav-item:hover i {
    color: white;
}

body.dark-mode .nav-item i {
    color: white;
}

.nav-item.active {
    background: var(--grad-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.nav-item.active i {
    color: white;
}

.nav-item i {
    font-size: 20px;
    margin-right: 12px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-sidebar);
}

.currency-rates {
    margin-bottom: 16px;
    padding: 12px;
    background-color: var(--bg-body);
    border-radius: 8px;
    font-size: 0.85rem;
}

.rate-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.rate-item:last-child {
    margin-bottom: 0;
}

.icon-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.icon-btn:hover {
    background-color: var(--bg-body);
    color: var(--text-primary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
}

.top-bar {
    height: var(--header-height);
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.user-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Offline/Sync Indicator */
.sync-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.sync-indicator.offline {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.sync-indicator.syncing {
    background-color: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.sync-indicator.synced {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.avatar {
    width: 32px;
    height: 32px;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.content-wrapper {
    padding: 24px;
    /* Reduced from 32px */
}

/* Common Components */
.hidden {
    display: none !important;
}

.view-section {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    outline: none;
    gap: 8px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--grad-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 8px 16px rgba(79, 70, 229, 0.35);
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Secondary Actions / Warning (Orange) */
.btn.warning,
.btn-secondary {
    background: var(--grad-accent);
    color: white;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.btn.warning:hover,
.btn-secondary:hover {
    box-shadow: 0 8px 16px rgba(249, 115, 22, 0.35);
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Danger Actions (Red) */
.btn.danger {
    background: var(--grad-danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn.danger:hover {
    box-shadow: 0 8px 16px rgba(239, 68, 68, 0.35);
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Link Button */
.btn-link {
    background: transparent;
    color: var(--primary);
    box-shadow: none;
    padding: 8px;
}

.btn-link:hover {
    background-color: rgba(79, 70, 229, 0.05);
    /* Tinted hover */
    text-decoration: none;
    transform: none;
}

.input-field {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-with-icon i {
    position: absolute;
    left: 14px;
    color: var(--text-secondary);
    font-size: 20px;
    pointer-events: none;
}

.input-with-icon .input-field {
    padding-left: 42px;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}


/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    /* Reduced min-width */
    gap: 20px;
    /* Reduced gap */
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.card {
    background-color: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-body);
}

.card-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.text-sm {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.card-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.input-group {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: var(--bg-card);
    overflow: hidden;
}

.input-group .prefix {
    padding: 8px 12px;
    background-color: var(--bg-body);
    border-right: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 500;
}

.input-group .input-field {
    border: none;
    border-radius: 0;
}

.full-width {
    width: 100%;
}

/* Stat Cards (Legacy class from previous step, kept for dashboard) */
.stat-card {
    background-color: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
}


.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 16px;
}

.icon-box.blue {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.icon-box.green {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.icon-box.orange {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.icon-box.pink {
    background-color: rgba(236, 72, 153, 0.1);
    color: #ec4899;
}

.stat-info h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-info .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* POS Layout */
.pos-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    height: calc(100vh - 120px);
    /* Adjust based on header/padding */
}

@media (max-width: 900px) {
    .pos-layout {
        grid-template-columns: 1fr;
        height: auto;
        gap: 16px;
    }
}

@media (max-width: 600px) {
    #btn-open-scanner {
        padding: 0 12px !important;
        height: 42px;
    }
}

/* Product Grid (POS) */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 16px;
}

.product-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    /* Changed from center to top align */
    gap: 12px;
    min-height: 80px;
    height: auto;
}

.product-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* .prod-img styles removed */

.prod-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    /* Allow text truncate */
}

.prod-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: normal;
    overflow: visible;
    line-height: 1.2;
}

.prod-sku {
    font-size: 0.7rem;
}

.prod-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.95rem;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Cart (POS) */
.client-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.85rem;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border);
}

.cart-item-details {
    flex: 1;
}

.cart-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.hidden-role {
    display: none !important;
}

.cart-item-title {
    font-weight: 500;
    font-size: 0.9rem;
}

.cart-item-price {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.cart-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cart-controls button {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg-body);
    cursor: pointer;
    color: var(--text-primary);
}

.cart-controls button:hover {
    background: var(--border);
}

.cart-footer {
    padding: 16px;
    background-color: var(--bg-body);
}

.totals {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1.2rem;
}

.total-row.sm {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-secondary);
}

/* Client Option in Modal */
.client-option {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}


.client-option {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.client-option:hover {
    background-color: var(--bg-body);
}

.text-xs {
    font-size: 0.75rem;
}


/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    /* Reduced from 12px 16px */
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    /* Slightly smaller text */
}

.data-table th {
    background: var(--grad-primary);
    /* Vibrant Header */
    font-weight: 600;
    font-size: 0.85rem;
    color: white;
    /* White text */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: none;
    /* Remove border for cleaner look */
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
    /* Subtle shadow */
}

/* First and Last th border radius */
.data-table th:first-child {
    border-top-left-radius: 8px;
}

.data-table th:last-child {
    border-top-right-radius: 8px;
}

.data-table tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Badges */
.badge {
    padding: 4px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge.gray {
    background-color: var(--border);
    color: var(--text-secondary);
}

.badge.green {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge.red {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge.blue {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
    opacity: 1;
    transition: opacity 0.2s;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
    /* Force hide to prevent clicks */
}

.modal-content {
    background-color: var(--bg-card);
    width: 90%;
    /* Responsive width */
    max-width: 500px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    margin: 0;
    /* Remove auto, let flexbox center it */
}

.modal-content>form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Removed duplicate .modal-body */

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 0;
    /* Handled by modal-body */
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-grid .form-group {
    margin-bottom: 0;
}

.mb-4 {
    margin-bottom: 16px;
}

/* Print Styles */
@media print {
    @page {
        size: 80mm auto;
        /* Width Height */
        margin: 0;
        /* Browser margin zero, we handle it in container */
    }

    /* Hide all direct children of body by default */
    body>* {
        display: none !important;
    }

    /* ONLY show the print area */
    body>#print-area {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 72mm;
        /* 80mm - 4mm padding each side approx */
        margin: 0 auto;
        padding: 5mm;
        /* 5mm padding as requested */
        background: var(--bg-card);
        color: black;
        font-family: 'Courier New', Courier, monospace;
        /* Thermal standard */
        font-size: 12px;
        z-index: 9999;
    }

    /* Restore visibility for print area contents */
    #print-area * {
        visibility: visible;
    }

    /* Print Formatting */
    .receipt-header {
        text-align: center;
        margin-bottom: 10px;
    }

    .receipt-title {
        font-size: 16px;
        font-weight: bold;
        text-transform: uppercase;
    }

    .receipt-details {
        margin-bottom: 10px;
        border-bottom: 1px dashed black;
        padding-bottom: 5px;
    }

    .receipt-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 10px;
    }

    .receipt-table th {
        text-align: left;
        border-bottom: 1px solid black;
        font-size: 11px;
    }

    .receipt-table td {
        padding: 4px 0;
        border-bottom: none;
        vertical-align: top;
    }

    .receipt-totals {
        text-align: right;
        border-top: 1px dashed black;
        padding-top: 5px;
        font-weight: bold;
    }

    .receipt-footer {
        text-align: center;
        margin-top: 15px;
        font-size: 10px;
    }

    /* Hide UI noise */
    .sidebar,
    .login-overlay,
    .modal,
    .main-content {
        display: none !important;
    }
}

/* Finance Tabs */
.tabs-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: 0.2s;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Finance Cards Colors */
.icon-box.purple {
    background-color: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.icon-box.cyan {
    background-color: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}

/* Alert Row */
.due-alert {
    background-color: rgba(239, 68, 68, 0.05);
}

.due-alert-urgent {
    color: var(--danger);
    font-weight: 700;
}

/* Search and Filter Row */
.finance-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

/* Help Section Styles */
.help-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px;
}

.help-header {
    text-align: center;
    padding: 40px;
    margin-bottom: 32px;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-body) 100%);
}

.help-header h1 {
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--primary);
}

.help-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.help-step {
    padding: 32px;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.2s;
}

.help-step:hover {
    transform: translateY(-5px);
}

.help-icon {
    width: 56px;
    height: 56px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 20px;
}

.help-step h3 {
    margin-bottom: 12px;
    font-size: 1.25rem;
}

.help-step p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.help-list {
    padding-left: 20px;
    margin-bottom: 16px;
}

.help-list li {
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.help-example {
    margin-top: auto;
    padding: 12px;
    background: var(--bg-body);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.help-example span {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.help-footer {
    text-align: center;
    margin-top: 60px;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Utilities */
.divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

.text-xs {
    font-size: 0.75rem;
}

.mt-1 {
    margin-top: 4px;
}

.mb-2 {
    margin-bottom: 8px;
}

#discount-row {
    color: var(--danger);
}

/* Mobile Styles */
@media (max-width: 768px) {
    .app-container {
        display: block;
    }

    /* Switch to block to avoid flex issues with fixed elements */
    .sidebar {
        position: fixed;
        left: -280px;
        /* Hide completely (width is 270px) */
        top: 0;
        height: 100vh;
        z-index: 1001;
        /* Higher than overlay */
        transition: left 0.3s ease;
        box-shadow: 4px 0 8px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        /* Remove sidebar space */
        width: 100%;
        padding: 0;
        /* Let children handle padding or reset */
    }

    .top-bar {
        padding: 0 16px;
    }

    .content-wrapper {
        padding: 16px;
    }

    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    .mobile-overlay.hidden {
        display: none;
    }

    .mobile-only {
        display: flex !important;
    }

    .brand {
        padding: 16px;
        justify-content: space-between;
    }

    .user-display span {
        display: none;
    }

    #btn-restart-onboarding {
        display: none !important;
    }

    /* Mobile Inventory Filter Refinement */
    .filters {
        grid-template-columns: 1fr 50px !important;
        gap: 8px !important;
    }

    .mobile-compact-filter {
        min-width: 50px !important;
        width: 50px !important;
        position: relative;
    }

    .mobile-compact-filter .icon-prefix {
        left: 50% !important;
        transform: translateX(-50%) !important;
    }

    .mobile-compact-filter select {
        color: transparent !important;
        width: 100% !important;
        padding: 0 !important;
        cursor: pointer;
        background: transparent !important;
        border: none !important;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        position: relative;
        z-index: 5;
    }

    .mobile-compact-filter select option {
        color: var(--text-main);
    }

    /* Fix modal sizes on mobile */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto;
        padding: 15px !important;
    }

    /* Cash register input visibility */
    .cash-counter input {
        font-size: 1.1rem !important;
        height: 45px !important;
    }

    /* Global responsive table wrapper */
    .table-responsive {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
    }

    .data-table,
    .premium-data-table {
        min-width: 650px;
        /* Ensure content doesn't squish too much */
    }
}

/* Bulk Grid for Inventory Modals */
.form-grid-bulk {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 12px;
    align-items: end;
}

@media (max-width: 480px) {
    .form-grid-bulk {
        grid-template-columns: 1.3fr 0.7fr;
        gap: 8px;
    }
}

/* Help Section Styles */
.help-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px;
}

.help-header {
    text-align: center;
    padding: 40px;
    margin-bottom: 32px;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-body) 100%);
}

.help-header h1 {
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--primary);
}

.help-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.help-step {
    padding: 32px;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.2s;
}

.help-step:hover {
    transform: translateY(-5px);
}

.help-icon {
    width: 56px;
    height: 56px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 20px;
}

.help-step h3 {
    margin-bottom: 12px;
    font-size: 1.25rem;
}

.help-step p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.help-list {
    padding-left: 20px;
    margin-bottom: 16px;
}

.help-list li {
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.help-example {
    margin-top: auto;
    padding: 12px;
    background: var(--bg-body);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.help-example span {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.help-footer {
    text-align: center;
    margin-top: 60px;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Utilities */
.divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

.text-xs {
    font-size: 0.75rem;
}

.mt-1 {
    margin-top: 4px;
}

.mb-2 {
    margin-bottom: 8px;
}

#discount-row {
    color: var(--danger);
}

/* Mobile Styles */
@media (max-width: 768px) {
    .app-container {
        display: block;
    }

    /* Switch to block to avoid flex issues with fixed elements */
    .sidebar {
        position: fixed;
        left: -280px;
        /* Hide completely (width is 270px) */
        top: 0;
        height: 100vh;
        z-index: 1001;
        /* Higher than overlay */
        transition: left 0.3s ease;
        box-shadow: 4px 0 8px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .main-content {
        margin-left: 0;
        /* Remove sidebar space */
        width: 100%;
        padding: 0;
        /* Let children handle padding or reset */
    }

    .top-bar {
        padding: 0 16px;
    }

    .content-wrapper {
        padding: 16px;
    }

    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    .mobile-overlay.hidden {
        display: none;
    }

    .mobile-only {
        display: flex !important;
    }

    .brand {
        padding: 16px;
        justify-content: space-between;
    }

    .user-display span {
        display: none;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}

/* POS Action Buttons (Refined) */
.pos-action-btn {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: none;
    background-color: var(--bg-body);
    /* Default neutral background */
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 24px;
    box-shadow: inset 0 0 0 1px var(--border);
    /* Soft border via shadow */
    position: relative;
    flex-shrink: 0;
}

.pos-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background-color: white;
    color: var(--primary);
}

.pos-action-btn:active {
    transform: translateY(0);
}

/* Pause Button (Warning) */
.pos-action-btn.warning {
    color: var(--warning);
    background-color: rgba(245, 158, 11, 0.1);
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.2);
}

.pos-action-btn.warning:hover {
    background-color: var(--warning);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Clear Button (Danger) */
.pos-action-btn.danger {
    color: var(--danger);
    background-color: rgba(239, 68, 68, 0.1);
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.pos-action-btn.danger:hover {
    background-color: var(--danger);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Drafts Button (Neutral/Info) */
.pos-action-btn.info {
    color: var(--primary);
    background-color: rgba(79, 70, 229, 0.1);
    box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.2);
}

.pos-action-btn.info:hover {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.pos-action-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 99px;
    background: var(--danger);
    color: white;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.hidden-role {
    display: none !important;
}

/* Help Layout (Split View - Premium) */
.help-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    /* Chat wider for better readability */
    gap: 32px;
    height: calc(100vh - 100px);
}

/* Scrollable Content Left */
.help-content {
    overflow-y: auto;
    padding-right: 16px;
}

/* Chat Container Right */
.help-chat {
    height: 100%;
}

.chat-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    border-radius: 20px;
    /* Softer corners */
    overflow: hidden;
    background: var(--bg-card);
    /* Clean white */
    border: 1px solid var(--border);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
    /* Elegant shadow */
}

/* Header */
.chat-header {
    padding: 20px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 16px;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.chat-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.chat-header small {
    color: var(--success);
    font-weight: 500;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: #f9fafb;
    scroll-behavior: smooth;
}

body.dark-mode .chat-messages {
    background-color: var(--bg-body);
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: slideUpFade 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
}

.bubble {
    padding: 16px 20px;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.6;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.message.bot .bubble {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message.user .bubble {
    background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.message.typing .bubble {
    color: var(--text-secondary);
    font-style: italic;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.02);
    border: none;
    box-shadow: none;
}

/* Chat Input Area (The requested improvement) */
.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    background: var(--bg-card);
    align-items: center;
}

#chat-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid transparent;
    border-radius: 14px;
    background: #f3f4f6;
    outline: none;
    transition: all 0.2s;
    font-size: 1rem;
    color: var(--text-primary);
}

body.dark-mode #chat-input {
    background: var(--bg-body);
}

#chat-input:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

#btn-send-chat {
    width: 52px;
    /* Much Larger */
    height: 52px;
    border-radius: 14px;
    background: var(--primary);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 24px;
    /* Larger Icon */
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

#btn-send-chat:hover {
    transform: translateY(-2px);
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

#btn-send-chat:active {
    transform: scale(0.95);
}

/* Mobile Responsive */
@media (max-width: 900px) {
    .help-layout {
        display: flex;
        flex-direction: column-reverse;
        height: auto;
    }

    .help-content {
        overflow-y: visible;
        padding-right: 0;
    }

    .help-chat {
        height: 600px;
        margin-top: 32px;
    }

    .chat-card {
        border-radius: 16px;
    }
}

/* --- LIVELY THEME OVERRIDES --- */

/* 1. Vibrant Table Headers */
.data-table th {
    background: var(--grad-primary) !important;
    color: white !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: none !important;
    padding: 12px !important;
}

.data-table th:first-child {
    border-top-left-radius: 8px;
}

.data-table th:last-child {
    border-top-right-radius: 8px;
}

/* 2. Vibrant Sidebar Active State */
.nav-item.active {
    background: var(--grad-primary) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.nav-item.active i {
    color: white !important;
}

/* 3. Vibrant Action Buttons (Icon Btn) */
.icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 6px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover {
    background: var(--grad-primary) !important;
    color: white !important;
    border-color: transparent !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

.icon-btn.delete:hover {
    background: var(--grad-danger) !important;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* 4. POS Action Buttons */
.pos-action-btn:hover {
    background: var(--bg-card);
    color: var(--primary) !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* POS Cart Image Styles */
.cart-item-image {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 6px;
    object-fit: cover;
    border: 1px solid var(--border);
    background-color: var(--bg-body);
    margin-right: 8px;
}

.cart-item-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 6px;
    background-color: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    color: var(--text-secondary);
}

/* 5. Barcode Scanner Styles */
#reader {
    border: 2px solid var(--primary);
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.2);
    margin-bottom: 15px;
}

#reader video {
    border-radius: 6px;
}

#scanner-modal .modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.pos-action-btn.warning {
    color: #f59e0b !important;
}

.pos-action-btn.danger {
    color: var(--danger) !important;
}

/* Pagination & Filters */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 10px;
}

.page-btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.category-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-body);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    font-size: 0.9rem;
    outline: none;
    min-width: 150px;
}

.filter-select:focus {
    border-color: var(--primary);
}

@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select {
        width: 100%;
    }
}

/* 6. Mobile Refinements */
@media (max-width: 768px) {
    .card-header.flex-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }

    .header-actions {
        width: 100%;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .header-actions .btn {
        flex: 1;
        justify-content: center;
        padding: 10px 8px;
        font-size: 0.85rem;
        min-width: 120px;
    }

    /* Table priorities on mobile */
    .data-table th:nth-child(2),
    .data-table td:nth-child(2) {
        /* Often the second column is a less critical ID/Ref */
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .content-wrapper {
        padding: 12px;
    }

    .card-body {
        padding: 16px;
    }

    .top-bar {
        padding: 0 16px;
    }
}

/* Mixed Payment Switches and Inputs */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.mixed-input {
    font-weight: 600;
    color: var(--primary);
}

.mixed-input:focus {
    background-color: var(--primary-light);
    color: white;
}

.mixed-input::placeholder {
    color: rgba(0, 0, 0, 0.2);
    font-weight: 400;
}

.dark-mode .mixed-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Expiration Warning Banner - Premium Redesign */
.expiration-banner {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    /* Primary Indigo */
    color: white;
    padding: 12px 24px;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.25);
    z-index: 1000;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideDownFade 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Special styling for Warning state (3 days) */
.expiration-banner.warning-active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    /* Warm Amber */
    box-shadow: 0 44px 20px rgba(245, 158, 11, 0.25);
}

.banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
}

#expiration-text {
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-banner {
    background: var(--bg-card);
    color: var(--primary);
    /* Match theme */
    padding: 8px 20px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.expiration-banner.warning-active .btn-banner {
    color: #d97706;
}

.btn-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    filter: brightness(1.05);
}

@keyframes slideDownFade {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .expiration-banner {
        padding: 16px;
    }

    .banner-content {
        flex-direction: column;
        gap: 12px;
    }

    #expiration-text {
        text-align: center;
    }
}

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    box-shadow: var(--shadow-sm);
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* AI Insights Styling */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.insight-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border-left: 4px solid var(--primary);
}

.insight-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.insight-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.insight-card:hover .insight-icon {
    background-color: var(--primary);
    color: white;
    transform: scale(1.1) rotate(5deg);
}

.insight-content {
    flex: 1;
}

.insight-msg {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.5;
    font-weight: 500;
}

/* Levels */
.insight-card.warning {
    border-left-color: var(--warning);
}

.insight-card.warning .insight-icon {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.insight-card.warning:hover .insight-icon {
    background-color: var(--warning);
    color: white;
}

.insight-card.success {
    border-left-color: var(--success);
}

.insight-card.success .insight-icon {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.insight-card.success:hover .insight-icon {
    background-color: var(--success);
    color: white;
}

.insight-card.danger {
    border-left-color: var(--danger);
}

.insight-card.danger .insight-icon {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.insight-card.danger:hover .insight-icon {
    background-color: var(--danger);
    color: white;
}

.insight-card.loading {
    align-items: center;
    justify-content: center;
    font-style: italic;
    border-left-color: var(--border);
    color: var(--text-secondary);
}

.insight-card.loading i {
    font-size: 24px;
    margin-right: 10px;
    color: var(--primary);
}

.insight-card.nav-item i {
    font-size: 24px;
    margin-right: 12px;
    flex-shrink: 0;
    color: var(--primary);
}

body.dark-mode .nav-item i {
    color: white;
}

/* Dashboard Stat Card Enhancements */
.stat-card {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--border);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card .icon-box {
    transition: all 0.3s ease;
}

.stat-card:hover .icon-box {
    transform: scale(1.1) rotate(5deg);
}

/* Stat Card Color Accents */
.stat-card.blue {
    border-left-color: var(--primary);
}

.stat-card.green {
    border-left-color: var(--success);
}

.stat-card.orange {
    border-left-color: var(--warning);
}

.stat-card.cyan {
    border-left-color: #06b6d4;
}

.stat-card.teal {
    border-left-color: #14b8a6;
}

.stat-card.purple {
    border-left-color: #8b5cf6;
}

/* Missing Teal Icon Box */
.icon-box.teal {
    background-color: rgba(20, 184, 166, 0.1);
    color: #14b8a6;
}

.stat-card:hover {
    border-color: var(--primary-light);
}

/* Violet glow on hover */

/* Stat Card Icon Hover Effects */
.stat-card.blue:hover .icon-box.blue {
    background-color: var(--primary);
    color: white;
}

.stat-card.green:hover .icon-box.green {
    background-color: var(--success);
    color: white;
}

.stat-card.orange:hover .icon-box.orange {
    background-color: var(--warning);
    color: white;
}

.stat-card.cyan:hover .icon-box.cyan {
    background-color: #06b6d4;
    color: white;
}

.stat-card.teal:hover .icon-box.teal {
    background-color: #14b8a6;
    color: white;
}

.stat-card.purple:hover .icon-box.purple {
    background-color: #8b5cf6;
    color: white;
}

/* Header Button Contrast Logic */
.btn-header-contrast {
    background-color: white !important;
    color: var(--warning) !important;
    border: none !important;
}

body.dark-mode .btn-header-contrast {
    background-color: var(--warning) !important;
    color: white !important;
}

/* Orange Header & Tabs */
.orange-header {
    background-color: var(--warning) !important;
    color: white !important;
    border-bottom: none !important;
}

.orange-header h3 {
    color: white !important;
}

.orange-header .tab-btn {
    color: rgba(255, 255, 255, 0.8);
    background: transparent;
    border: 1px solid transparent;
}

.orange-header .tab-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.orange-header .tab-btn.active {
    background: var(--bg-card);
    color: var(--warning);
    border-color: white;
    font-weight: 600;
}

/* Dark Mode Header Override */
body.dark-mode .orange-header {
    background-color: var(--bg-body) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border) !important;
}

body.dark-mode .orange-header h3 {
    color: var(--text-primary) !important;
}

body.dark-mode .orange-header .tab-btn {
    color: var(--text-secondary);
}

body.dark-mode .orange-header .tab-btn.active {
    background: transparent;
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    border-radius: 0;
}

/* Header Buttons (Light Mode: White, Dark Mode: Transparent/Standard) */
.btn-header-white {
    background-color: white !important;
    border: none !important;
}

body.dark-mode .btn-header-white {
    background-color: transparent !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
}

body.dark-mode .btn-header-white.action-warning {
    color: var(--warning) !important;
}

body.dark-mode .btn-header-white.action-danger {
    color: var(--danger) !important;
}

body.dark-mode .btn-header-white.action-primary {
    color: var(--primary) !important;
}

/* Dashboard Alerts */
.alert-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
}

.alert-item.expired {
    background: #fff1f2;
}

body.dark-mode .alert-item {
    background: var(--bg-card);
    border-color: var(--border);
}

body.dark-mode .alert-item.expired {
    background: rgba(127, 29, 29, 0.2);
}

/* Dark Mode Text Fixes */
body.dark-mode .text-dark-contrast {
    color: var(--text-primary) !important;
}

body.dark-mode select,
body.dark-mode input {
    color: white !important;
    background-color: var(--bg-card) !important;
}

body.dark-mode option {
    background-color: var(--bg-card) !important;
    color: white !important;
}

/* Dashboard Alert Names - Ensuring visibility even if background changes */
body.dark-mode .alert-item div[style*="font-weight: 600"] {
    color: var(--text-primary) !important;
}

/* POS Credit Button */
.btn-credit-contrast {
    background-color: var(--warning) !important;
    color: white !important;
    border: none !important;
}

body.dark-mode .btn-credit-contrast {
    background-color: transparent !important;
    color: var(--warning) !important;
    border: 1px solid var(--border) !important;
}

/* Inventory Tags Button */
body.dark-mode .btn-tags-contrast {
    background: transparent !important;
    color: white !important;
    border: 1px solid var(--border) !important;
}

/* Reports Filter & Pagination */
body.dark-mode #btn-filter-report {
    color: white !important;
    border-color: var(--border) !important;
    background: transparent !important;
}

body.dark-mode .input-field::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Pagination Arrows Dark Mode */
body.dark-mode .pagination-container button {
    color: white !important;
    background: var(--bg-card);
    border-color: var(--border);
}

body.dark-mode .pagination-container button:disabled {
    color: var(--text-secondary) !important;
}

/* PRINT STYLES */
@media print {
    @page {
        size: letter;
        margin: 10mm;
    }

    html,
    body {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        color: #000 !important;
    }

    /* Hide everything except print area */
    body>*:not(#print-area) {
        display: none !important;
    }

    #print-area {
        display: block !important;
        width: 100% !important;
        position: static !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Format: Carta */
    .print-container.carta {
        width: 100%;
        margin: 0;
        padding: 40px;
        font-family: 'Inter', sans-serif;
        box-sizing: border-box;
    }

    .carta-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 40px;
        border-bottom: 2px solid #333;
        padding-bottom: 20px;
    }

    .company-info {
        flex: 1;
    }

    .company-name {
        font-size: 28px;
        color: var(--primary) !important;
        margin-bottom: 8px;
        font-weight: 800;
        text-transform: uppercase;
    }

    .company-info p {
        margin: 4px 0;
        font-size: 14px;
        color: #333;
    }

    .document-info {
        text-align: right;
        flex: 1;
    }

    .document-info h2 {
        font-size: 24px;
        margin-bottom: 15px;
        color: #000;
        font-weight: 700;
    }

    .document-info p {
        margin: 4px 0;
        font-size: 14px;
    }

    .client-box {
        margin-bottom: 30px;
        background: #f3f4f6 !important;
        padding: 20px;
        border-radius: 8px;
        -webkit-print-color-adjust: exact;
        display: flex;
        justify-content: space-between;
    }

    .carta-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 40px;
    }

    .carta-table th {
        background: #000 !important;
        color: #fff !important;
        padding: 12px;
        text-align: left;
        border-bottom: 1px solid #000;
        -webkit-print-color-adjust: exact;
        font-weight: 600;
    }

    .carta-table td {
        padding: 12px;
        border-bottom: 1px solid #eee;
        font-size: 14px;
    }

    .carta-summary {
        display: flex;
        justify-content: flex-end;
        page-break-inside: avoid;
        margin-top: 20px;
    }

    .summary-details {
        width: 400px;
        /* Slightly wider */
    }

    .summary-row {
        display: flex;
        justify-content: space-between;
        padding: 10px 0;
        border-bottom: 1px solid #f3f4f6;
    }

    .summary-row.grand-total {
        font-size: 20px;
        font-weight: 800;
        border-top: 2px solid #000;
        border-bottom: 2px solid #000;
        margin-top: 15px;
        padding: 15px 0;
    }

    .summary-row.ves {
        color: #10b981 !important;
        font-weight: 700;
        font-size: 16px;
    }

    /* Format: Tickets */
    .ticket-80 {
        width: 80mm;
        padding: 5mm;
    }

    .ticket-58 {
        width: 58mm;
        padding: 2mm;
        font-size: 12px;
    }

    .print-container:not(.carta) {
        margin: 0;
        font-family: monospace;
    }

    .receipt-header {
        text-align: center;
        margin-bottom: 10px;
    }

    .receipt-title {
        font-weight: bold;
        font-size: 1.2rem;
    }

    .receipt-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.85rem;
    }

    .receipt-totals {
        margin-top: 10px;
        border-top: 1px dashed #ccc;
        padding-top: 5px;
    }

    .total-line {
        font-weight: bold;
        font-size: 1rem;
    }

    .receipt-footer {
        text-align: center;
        margin-top: 15px;
        font-size: 0.8rem;
        border-top: 1px dashed #ccc;
        padding-top: 5px;
    }
}

/* --- Break Even Traffic Light Bar --- */
.be-traffic-light {
    position: relative;
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    /* Contains the background zones */
    margin: 20px 0 10px 0;
    display: flex;
}

.be-zone {
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.be-zone.danger {
    background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
    width: 33.33%;
    /* Default, will be dynamic logic-wise or just visual steps */
}

.be-zone.warning {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
    width: 33.33%;
}

.be-zone.success {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    width: 33.33%;
}

/* The actual marker/needle */
.be-needle {
    position: absolute;
    top: -4px;
    height: 32px;
    width: 4px;
    background: #1f2937;
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 10;
    transition: left 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy spring */
    transform: translateX(-50%);
    /* Center on position */
}

.be-needle::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid #1f2937;
}

.be-needle-label {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.be-traffic-light:hover .be-needle-label {
    opacity: 1;
}

/* Range Slider Styling */
.range-slider-container {
    margin-bottom: 16px;
}

.range-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.range-val {
    font-weight: 700;
    color: var(--primary);
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: var(--border);
    border-radius: 3px;
}

/* Simulator Results */
.sim-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
    background: var(--bg-body);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.sim-item {
    text-align: center;
}

.sim-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.sim-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.diff-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
    font-weight: 600;
}

.diff-badge.positive {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.diff-badge.negative {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* =========================================
   Desktop Sidebar Toggle (Added Feature)
   ========================================= */

.desktop-only {
    display: none !important;
}

@media (min-width: 1025px) {
    .desktop-only {
        display: flex !important;
    }

    /* Collapsed Sidebar State */
    body.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-collapsed .main-content {
        margin-left: 0;
        width: 100%;
    }

    /* Smooth Transitions */
    .sidebar,
    .main-content {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* Break Even Responsive Layout */
.details-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    align-items: start;
}

.sim-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (max-width: 900px) {
    .details-grid {
        grid-template-columns: 1fr !important;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        /* Stack cards on mobile */
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .period-selector {
        width: 100%;
    }

    .period-selector select {
        width: 100% !important;
    }

    .sim-grid {
        grid-template-columns: 1fr;
    }
}

/* --- PREMIUM HELP SECTION --- */
.help-premium-layout {
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    padding-bottom: 80px;
}

/* Hero Section */
.help-hero {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, var(--bg-card) 0%, #eef2ff 100%);
    border-radius: 24px;
    box-shadow: inset 0 2px 10px rgba(255, 255, 255, 0.5), 0 4px 20px rgba(0, 0, 0, 0.05);
}

body.dark-mode .help-hero {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-body) 100%);
    box-shadow: inset 0 2px 10px rgba(255, 255, 255, 0.05), 0 4px 20px rgba(0, 0, 0, 0.3);
}

.help-hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.help-hero p {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.help-search-bar {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
}

.help-search-bar i {
    position: absolute;
    left: 20px;
    font-size: 24px;
    color: var(--text-secondary);
}

.help-search-bar input {
    width: 100%;
    padding: 20px 20px 20px 56px;
    border-radius: 99px;
    border: 2px solid transparent;
    background: var(--bg-card);
    font-size: 1.1rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    outline: none;
    color: var(--text-primary);
}

body.dark-mode .help-search-bar input {
    background: var(--bg-card);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.help-search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 8px 30px rgba(79, 70, 229, 0.2);
}

/* Grid */
.help-premium-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.help-glass-card {
    padding: 32px;
    border-radius: 20px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.help-glass-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 40px rgba(79, 70, 229, 0.15);
    border-color: var(--primary);
}

.help-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(99, 102, 241, 0.2) 100%);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 20px;
}

.help-glass-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.help-glass-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Knowledge Base */
.help-popular-articles {
    padding: 0 20px;
}

.help-popular-articles h3 {
    font-size: 1.5rem;
    margin-bottom: 24px;
}

.popular-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.popular-item {
    display: flex;
    align-items: center;
    padding: 24px;
    background: var(--bg-card);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.popular-item:hover {
    transform: translateX(5px);
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.popular-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-right: 20px;
}

.popular-text {
    flex: 1;
}

.popular-text h4 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.popular-text span {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.popular-arrow {
    font-size: 24px;
    color: var(--text-secondary);
}

/* Floating Chat */
.floating-chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.floating-chat-btn:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 15px 40px rgba(79, 70, 229, 0.5);
}

/* Chat Popup */
.help-chat-popup {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 140px);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
    display: flex;
    flex-direction: column;
}

.help-chat-popup.hidden {
    opacity: 0;
    transform: scale(0.5) translateY(50px);
    pointer-events: none;
}

.premium-chat-header {
    background: linear-gradient(135deg, white 0%, #f9fafb 100%);
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.dark-mode .premium-chat-header {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-body) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-header-text h3 {
    margin-bottom: 2px;
}

.chat-header-text span {
    font-size: 0.85rem;
    color: var(--success);
    font-weight: 500;
}

.close-chat-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.close-chat-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

@media (max-width: 768px) {
    .help-chat-popup {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .help-chat-popup .chat-card {
        border-radius: 0;
    }

    .floating-chat-btn {
        bottom: 20px;
        right: 20px;
    }

    .help-premium-layout {
        padding: 16px;
    }

    .help-hero {
        padding: 40px 20px;
    }
}

/* --- PREMIUM SETTINGS (CONFIGURACIÓN) SECTION --- */
/* Layout structure */
.settings-premium-layout {
    display: flex;
    max-width: 1300px;
    margin: 0 auto;
    gap: 40px;
    padding: 24px;
    min-height: calc(100vh - 100px);
}

/* Sidebar Styling */
.settings-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 24px;
}

.settings-tab {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: transparent;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.settings-tab i {
    font-size: 22px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.settings-tab:hover {
    background: rgba(79, 70, 229, 0.05);
    color: var(--primary);
}

.settings-tab:hover i {
    color: var(--primary);
}

.settings-tab.active {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.settings-tab.active i {
    color: var(--primary);
}

body.dark-theme .settings-tab:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-theme .settings-tab.active {
    background: rgba(79, 70, 229, 0.2);
}

/* Main Content Area */
.settings-content {
    flex: 1;
    max-width: 800px;
}

/* Pane Visibility */
.settings-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.settings-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header within Panes */
.settings-header {
    margin-bottom: 32px;
}

.settings-header h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.settings-header p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Default Card Style for Forms */
.default-card {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    overflow: hidden;
}

body.dark-theme .default-card {
    background: var(--bg-card);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.form-section {
    padding: 32px;
}

.form-section h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.form-section h3 i {
    color: var(--primary);
    font-size: 24px;
}

/* Premium Form Elements */
.premium-input-group {
    margin-bottom: 24px;
}

.premium-input-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.icon-prefix {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1rem;
}

.input-with-icon .input-field {
    padding-left: 56px;
}

.placeholder-styled::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.input-field {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--bg-body);
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.input-field:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    outline: none;
}

/* Form Row (Side by side) */
.form-row {
    display: flex;
    gap: 20px;
}

.half-width {
    flex: 1;
}

/* Helper Text */
.input-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Premium Select */
.premium-select-wrapper {
    position: relative;
}

.premium-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 48px;
    cursor: pointer;
}

.select-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Toggle Rows */
.premium-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-body);
    color: var(--text-primary);
    margin-bottom: 24px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.toggle-info strong {
    display: block;
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.toggle-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.premium-divider {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 32px 0;
}

/* Logo Upload Zone */
.logo-upload-zone {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    background: var(--bg-body);
    margin-bottom: 32px;
    cursor: pointer;
    transition: all 0.2s;
}

.logo-upload-zone:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.02);
}

.upload-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.upload-text strong {
    display: block;
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 4px;
}

.upload-text p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Action Bar */
.settings-action-bar {
    padding: 24px 32px;
    background: var(--bg-body);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.btn-premium {
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-premium.primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-premium.primary:hover {
    background: var(--bg-card);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

/* Responsive */
@media (max-width: 900px) {
    .settings-premium-layout {
        flex-direction: column;
        padding: 16px;
    }

    .settings-sidebar {
        width: 100%;
    }

    .settings-nav {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 10px;
        position: static;
        /* Scroll hide */
        scrollbar-width: none;
    }

    .settings-nav::-webkit-scrollbar {
        display: none;
    }

    .settings-tab {
        white-space: nowrap;
        padding: 12px 16px;
        background: var(--bg-card);
        border: 1px solid var(--border);
    }

    .settings-tab.active {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
    }

    .settings-tab.active i {
        color: white;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-section {
        padding: 20px;
    }

    .settings-action-bar {
        padding: 20px;
    }

    .btn-premium {
        width: 100%;
    }
}

/* --- PREMIUM TEAM (USUARIOS) SECTION --- */

.team-premium-layout {
    display: flex;
    flex-direction: column;
    gap: 32px;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header Section */
.team-header-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.header-text h2 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.header-text p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.team-header-section .header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-header-section .header-actions .btn-premium {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
}

.team-header-section .header-actions .btn-premium i {
    font-size: 20px;
}

/* Stats Grid */
.team-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.team-stat-card {
    display: flex;
    align-items: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s;
}

body.dark-theme .team-stat-card {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.team-stat-card:hover {
    transform: translateY(-4px);
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}

.team-stat-card:hover h3,
.team-stat-card:hover p,
.team-stat-card:hover .value,
.team-stat-card:hover .text-secondary {
    color: white !important;
}

.team-stat-card:hover .stat-icon {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-right: 20px;
}

.stat-icon.admins {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(99, 102, 241, 0.2) 100%);
    color: var(--primary);
}

.stat-icon.employees {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(52, 211, 153, 0.2) 100%);
    color: var(--success);
}

.stat-info h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Data Table Container */
.team-table-container {
    padding: 0;
    overflow-x: auto;
}

.premium-data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.premium-data-table th {
    background: #f9fafb;
    padding: 20px 24px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    text-align: left;
}

body.dark-theme .premium-data-table th {
    background: var(--bg-body);
}

.premium-data-table th.text-right,
.premium-data-table td.text-right {
    text-align: right;
}

.premium-data-table td {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.premium-data-table tbody tr:last-child td {
    border-bottom: none;
}

.premium-data-table tbody tr {
    transition: background 0.2s;
}

.premium-data-table tbody tr:hover {
    background: rgba(79, 70, 229, 0.02);
}

/* User Profile Cell */
.user-profile-cell {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.user-avatar.admin {
    background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2), 0 4px 12px rgba(79, 70, 229, 0.3);
}

.user-avatar.employee {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2), 0 4px 12px rgba(16, 185, 129, 0.2);
}

.user-name-info strong {
    display: block;
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.user-name-info span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* User Contact Cell */
.user-contact-cell .contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.user-contact-cell .contact-item i {
    color: var(--primary);
}

/* Role Badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
}

.role-badge.admin {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.role-badge.employee {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Action Buttons */
.action-btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

body.dark-theme .action-btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.action-btn-icon.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    transform: scale(1.05);
}

/* Premium Modal */
.premium-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s;
}

.premium-modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.premium-modal-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 500px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    transform: scale(1) translateY(0);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

body.dark-theme .premium-modal-content {
    background: var(--bg-card);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.premium-modal-overlay.hidden .premium-modal-content {
    transform: scale(0.9) translateY(20px);
}

.premium-modal-content .modal-header {
    padding: 32px 32px 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    border-bottom: none;
    position: relative;
}

.modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(99, 102, 241, 0.2) 100%);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.modal-title-box h3 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.modal-title-box p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.close-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
}

body.dark-theme .close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.premium-modal-form .form-body {
    padding: 0 32px 32px;
}

.premium-modal-form .modal-actions {
    padding: 24px 32px;
    background: #f9fafb;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

body.dark-theme .premium-modal-form .modal-actions {
    background: var(--bg-body);
}

.btn-premium.secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary);
}

.btn-premium.secondary:hover,
.btn-premium.secondary:hover * {
    background: var(--primary);
    color: white !important;
    border-color: var(--primary);
}

body.dark-theme .btn-premium.secondary:hover,
body.dark-theme .btn-premium.secondary:hover * {
    background: var(--primary);
    color: white !important;
    border-color: var(--primary);
}

/* Responsive Team Layout */
@media (max-width: 768px) {
    .team-header-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .team-header-section .header-actions {
        width: 100%;
    }

    .team-header-section .header-actions .btn-premium {
        width: 100%;
        justify-content: center;
    }

    .premium-modal-content {
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }

    .premium-modal-form {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .premium-modal-form .form-body {
        flex: 1;
        overflow-y: auto;
    }
}

/* ==========================================================================
   [PREMIUM] Punto de Equilibrio (Break Even)
   ========================================================================== */

/* Layout & Typography */
.breakeven-premium-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 32px;
}

.breakeven-premium-layout .view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 16px;
}

/* KPI Cards */
.be-stat-card {
    display: flex;
    align-items: center;
    padding: 24px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    gap: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.be-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(79, 70, 229, 0.2);
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}

.be-stat-card:hover h3,
.be-stat-card:hover p,
.be-stat-card:hover .value,
.be-stat-card:hover div,
.be-stat-card:hover span {
    color: white !important;
}

.be-stat-card:hover .stat-icon {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
}

.be-stat-card .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
}

.stat-icon.admins {
    /* Reusing money color scheme */
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(16, 185, 129, 0.2) 100%);
    color: #10B981;
}

.stat-icon.purple-gradient {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(139, 92, 246, 0.2) 100%);
    color: #8B5CF6;
}

.stat-icon.orange-gradient {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.2) 100%);
    color: #F59E0B;
}

.be-stat-card .stat-info {
    flex: 1;
}

.be-stat-card .stat-info h3 {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 6px;
}

.be-stat-card .stat-info .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    margin-bottom: 4px;
}

/* Progress Section & Traffic Light */
.profit-goal-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.premium-traffic-light {
    display: flex;
    height: 20px;
    border-radius: 10px;
    background: var(--bg-body);
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    /* For rounded corners of inner zones */
    margin-top: 10px;
}

.be-zone {
    flex: 1;
    height: 100%;
    position: relative;
    opacity: 0.85;
}

.be-zone.danger {
    background: linear-gradient(90deg, #ef4444 0%, #fca5a5 100%);
}

.be-zone.warning {
    background: linear-gradient(90deg, #f59e0b 0%, #fcd34d 100%);
}

.be-zone.success {
    background: linear-gradient(90deg, #10b981 0%, #6ee7b7 100%);
}

.premium-needle {
    position: absolute;
    top: -6px;
    width: 4px;
    height: 32px;
    background: var(--text-main);
    transform: translateX(-50%);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    transition: left 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 10;
}

.premium-needle::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--text-main);
}

.premium-needle-label {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-main);
    color: var(--surface);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 1;
}

.premium-progress-container {
    height: 12px;
    background: var(--bg-body);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.premium-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #8b5cf6 100%);
    /* Primary gradient */
    transition: width 1s cubic-bezier(0.25, 1, 0.5, 1);
    border-radius: 6px;
}

/* Simulator Form & Results */
.sim-card {
    border-top: 4px solid var(--primary);
}

.sim-grid-premium {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.sim-controls-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.premium-range-slider {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: var(--bg-body);
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

.premium-range-slider .range-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    font-size: 0.95rem;
}

.range-val.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: currentColor;
    background: transparent;
}

.range-val.badge.blue {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.range-val.badge.orange {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.range-val.badge.purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -8px;
    /* Offset the thumb to center it */
    box-shadow: 0 2px 6px rgba(111, 0, 255, 0.3);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.05);
    /* Soft track */
    border-radius: 3px;
    border: 1px solid var(--border-light);
}

/* Simulator Results */
.sim-results-wrapper {
    background: linear-gradient(135deg, var(--surface) 0%, rgba(248, 250, 252, 0.4) 100%);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 24px;
    height: 100%;
}

.theme-dark .sim-results-wrapper {
    background: var(--surface);
}

.results-title {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 20px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 12px;
}

.sim-results-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sim-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-body);
    border-radius: 8px;
    font-size: 1rem;
}

.sim-item .sim-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.sim-item .sim-value {
    font-weight: 600;
    color: var(--text-main);
}

.sim-item.highlight {
    background: linear-gradient(135deg, rgba(111, 0, 255, 0.05) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
    padding: 16px;
}

.sim-item.highlight .sim-label {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.05rem;
}

.sim-item.highlight .sim-value {
    font-size: 1.25rem;
    font-weight: 800;
}

/* Expenses Summary Row */
.premium-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-body);
    border-radius: 12px;
    font-weight: 600;
    margin-top: 24px;
    border: 1px solid var(--border-light);
    font-size: 1.1rem;
}

.highlight-total {
    color: var(--danger);
    /* Highlight expenses in warning/danger color */
    font-weight: 800;
    font-size: 1.3rem;
}

/* Expenses List items */
.premium-expenses-list .expense-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.premium-expenses-list .input-field.bare-input {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 8px;
    transition: all 0.2s ease;
}

.premium-expenses-list .input-field.bare-input:hover,
.premium-expenses-list .input-field.bare-input:focus {
    background: var(--bg-body);
    border-color: var(--border);
}

/* Form specific layout */
.expenses-summary-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Responsiveness */
@media screen and (max-width: 900px) {
    .sim-grid-premium {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   [PREMIUM] FINANZAS
   ========================================================================== */

.finances-premium-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 32px;
}

.finances-premium-layout .view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 16px;
}

.finances-premium-layout .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

/* Tab tweaks */
.finance-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

@media (max-width: 768px) {
    .finance-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .finance-toolbar>div {
        width: 100%;
        justify-content: space-between;
    }
}

/* ==========================================================================
   [PREMIUM] DATA TABLES & ACTION BUTTONS
   ========================================================================== */

.premium-data-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
}

.premium-data-table th,
.premium-data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    color: var(--text-main);
}

.premium-data-table th {
    background: var(--primary);
    font-weight: 600;
    color: #ffffff;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.premium-data-table tr {
    transition: background-color 0.2s ease;
}

.premium-data-table tr:hover td {
    background-color: var(--bg-body);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-badge.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    background: transparent;
    color: var(--text-secondary);
}

.action-btn:hover {
    background: var(--surface);
    color: var(--text-main);
    border-color: var(--border);
}

.action-btn.view-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    border-color: rgba(59, 130, 246, 0.2);
}

.action-btn.edit-btn:hover {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.action-btn.success-btn {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.action-btn.success-btn:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.3);
}

.action-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

/* ==========================================================================
   [PREMIUM] REPORTES
   ========================================================================== */

.reports-premium-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-bottom: 32px;
}

/* ==========================================================================
   [PREMIUM] DASHBOARD SAAS
   ========================================================================== */

/* Segmented Control (Period Selector) */
.segmented-control {
    background: var(--surface);
}

.segment-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.segment-btn:hover {
    color: var(--text-main);
}

.segment-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

/* Shimmer Loading Effect */
.skeleton-text {
    position: relative;
    overflow: hidden;
    color: transparent !important;
    display: inline-block;
}

.skeleton-text::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--surface) 25%, var(--border-light) 50%, var(--surface) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.value-container {
    display: inline-block;
    min-width: 80px;
    min-height: 24px;
}


.dashboard-grid {
    display: grid;
    gap: 20px;
}

.stat-card-premium {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-body);
    border-radius: 16px;
    border: 2px solid var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.dash-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.dash-info h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dash-info .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.dash-info .value.primary-val {
    color: var(--primary);
}

.dash-info .value.success-val {
    color: var(--success);
}

.dash-info .sub-val {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

.chart-section {
    background: var(--bg-body);
    border-radius: 16px;
    border: 2px solid var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.chart-section h3.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.stat-card-compact {
    padding: 16px 20px;
    background: var(--bg-body);
    border-radius: 12px;
    border: 2px solid var(--primary);
    border-top-width: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.stat-card-compact h4 {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card-compact .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-card-compact .sub-val {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}

.border-top-primary {
    border-top-color: var(--primary);
}

.border-top-danger {
    border-top-color: var(--danger);
}

.border-top-warning {
    border-top-color: var(--warning);
}

.border-top-orange {
    border-top-color: #f97316;
}

.alerts-section {
    background: var(--bg-body);
    border-radius: 16px;
    border: 2px solid var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.glass-card {
    background: var(--bg-body);
    border-radius: 16px;
    border: 2px solid var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Cash Register Grids */
.cash-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.cash-main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 768px) {
    .cash-metrics-grid {
        grid-template-columns: 1fr;
    }

    .cash-main-grid {
        grid-template-columns: 1fr;
    }
}

.premium-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.premium-list li {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s;
}

.premium-list li:hover {
    background-color: var(--surface);
}

.hover-row {
    transition: background-color 0.2s ease;
}

.premium-data-table tr.hover-row:hover td {
    background-color: rgba(79, 70, 229, 0.05) !important;
}

.premium-list li:last-child {
    border-bottom: none;
}

.empty-state-list {
    padding: 24px !important;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.empty-state-list i {
    font-size: 24px;
    color: var(--border);
}

/* Dashboard Cards Hover Effects */
.stat-card-premium,
.stat-card-compact,
.chart-section,
.alerts-section,
.stat-card {
    transition: all 0.3s ease;
}

.stat-card-premium:hover,
.stat-card-compact:hover,
.stat-card:hover {
    background-color: var(--primary) !important;
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(79, 70, 229, 0.2);
}

.stat-card-premium:hover *,
.stat-card-compact:hover *,
.stat-card:hover * {
    color: white !important;
}

.stat-card-premium:hover .dash-icon,
.stat-card-compact:hover .dash-icon,
.stat-card:hover .icon-box {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
}

.alerts-section li:hover {
    background-color: var(--primary) !important;
    color: white !important;
    border-radius: 8px;
    cursor: pointer;
}

.alerts-section li:hover * {
    color: white !important;
}

/* --- Onboarding Tour Styles --- */
.onboarding-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(17, 24, 39, 0.6);
    /* Darker backdrop */
    z-index: 9998;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease;
}

.onboarding-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.onboarding-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 320px;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    border: 1px solid rgba(79, 70, 229, 0.2);
    transition: right 0.3s ease, left 0.3s ease;
}

.onboarding-widget.left-side {
    right: auto;
    left: 24px;
}

.onboarding-widget.hidden {
    display: none;
}

.onboarding-header {
    background: var(--grad-primary);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.onboarding-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.onboarding-body {
    padding: 16px;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.5;
}

.onboarding-body p {
    margin-bottom: 8px;
}

.onboarding-body p:last-child {
    margin-bottom: 0;
}

.onboarding-footer {
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

/* Highlight specific elements during onboarding */
.onboarding-highlight {
    position: relative;
    z-index: 10000 !important;
    animation: pulseGlow 1.5s infinite alternate;
    border-radius: inherit;
    /* Tries to respect the element's existing border-radius */
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.4), 0 0 15px rgba(79, 70, 229, 0.6) !important;
    background-color: white !important;
    /* Forces it to stand out against dark overlay */
}

/* Dark mode overrides */
.dark-mode .onboarding-widget {
    background: var(--surface);
    border-color: var(--border);
}

.dark-mode .onboarding-body {
    color: var(--text-main);
}

.dark-mode .onboarding-footer {
    background: var(--bg);
}

.dark-mode .onboarding-highlight {
    background-color: var(--surface) !important;
}

@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGlow {
    from {
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.6);
    }

    to {
        box-shadow: 0 0 0 8px rgba(79, 70, 229, 0);
    }
}