* { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: #f8fafc;
            margin: 0;
            padding: 0;
            min-height: 100vh;
        }

        .container {
            background: #ffffff;
            padding: 24px;
            width: 100%;
            opacity: 0;
            transform: translateY(20px);
            transition: all 0.5s ease;
        }

        .container.show { opacity: 1; transform: translateY(0); }

        h1 {
            color: #1f2937;
            font-size: 1.5rem;
            font-weight: 700;
            text-align: center;
            margin-bottom: 24px;
            letter-spacing: -0.5px;
        }

        .date-controls {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: 2rem;
            padding: 20px;
            background: #ffffff;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            margin-bottom: 20px;
        }
        .date-input-wrapper { display: flex; flex-direction: column; gap: 8px; }
        .date-input-wrapper label { font-weight: 600; color: #374151; font-size: 0.875rem; }
        .date-input-wrapper input, .date-input-wrapper select { padding: 10px 14px; border: 1px solid #E5E7EB; border-radius: 8px; font-size: 0.9rem; font-weight: 500; background: white; transition: all 0.3s ease; color: #1F2937; }
        .date-input-wrapper input:focus, .date-input-wrapper select:focus { outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1); transform: translateY(-2px); }

        .report-section { background: #ffffff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
        .report-section h3 { color: #1F2937; font-size: 1rem; font-weight: 600; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #e5e7eb; }
        .button-group { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }

        /* Preview Section Styles */
        .preview-section {
            background: #ffffff;
            border: 1px solid #e5e7eb;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 20px;
        }
        .preview-section h3 {
            color: #1F2937;
            font-size: 1rem;
            font-weight: 600;
            margin-bottom: 16px;
            padding-bottom: 12px;
            border-bottom: 1px solid #e5e7eb;
        }
        .preview-section h3 span {
            color: #4f46e5;
            font-weight: 700;
        }
        .preview-stats {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 16px;
            margin-bottom: 20px;
        }
        .stat-card {
            background: #f9fafb;
            border: 1px solid #e5e7eb;
            border-radius: 6px;
            padding: 12px;
            text-align: center;
        }
        .stat-label {
            display: block;
            font-size: 0.75rem;
            color: #6b7280;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 4px;
        }
        .stat-value {
            display: block;
            font-size: 1.5rem;
            font-weight: 700;
            color: #1F2937;
        }
        .preview-table-container {
            overflow-x: auto;
            border: 1px solid #e5e7eb;
            border-radius: 6px;
        }
        .preview-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.875rem;
        }
        .preview-table th {
            background: #f9fafb;
            padding: 8px;
            text-align: center;
            font-weight: 600;
            color: #374151;
            border-bottom: 1px solid #e5e7eb;
            text-transform: uppercase;
            font-size: 0.75rem;
        }
        .preview-table td {
            padding: 8px;
            text-align: center;
            border-bottom: 1px solid #f3f4f6;
        }
        .preview-table tbody tr:hover {
            background: #f9fafb;
        }
        .preview-table td:first-child {
            text-align: left;
            font-weight: 500;
        }
        .preview-note {
            padding: 8px;
            text-align: center;
            font-size: 0.75rem;
            color: #6b7280;
            background: #f9fafb;
            border-top: 1px solid #e5e7eb;
        }

        .download-btn {
            background: #4f46e5;
            color: white;
            border: none;
            padding: 12px 20px;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            text-align: center;
            box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
        }

        .download-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3); background: #4338ca; }
        .download-btn.secondary { background: #10b981; box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2); }
        .download-btn.secondary:hover { background: #059669; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }
        .download-btn.json-btn { background: #f59e0b; box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2); }
        .download-btn.json-btn:hover { background: #d97706; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
        .download-btn.sample-btn { background: #ef4444; box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2); }
        .download-btn.sample-btn:hover { background: #dc2626; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }

        /* Sales list styling */
        table { border-collapse: collapse; width: 100%; margin-top: 20px; border-radius: 12px; overflow: hidden; box-shadow: 0 0 20px rgba(0,0,0,0.1); }
        th, td { padding: 8px 12px; text-align: left; border: 1px solid #e3e8ee; }
        th { background: #e3f2fd; color: #1976d2; font-weight: 600; font-size: 0.9rem; }
        tr:hover { background: #f8fafc; transition: background 0.2s ease; }
        .no-sales { color: #888; font-style: italic; text-align: center; padding: 40px; font-size: 1.1rem; margin-top: 8px; }

        /* SLEEK PROFESSIONAL LOADING SCREEN */
        .loading-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #ffffff;
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 9999;
            transition: opacity 0.3s ease;
        }

        .loading-screen.hide {
            opacity: 0;
            visibility: hidden;
        }

        .loader-container {
            text-align: center;
            position: relative;
        }

        /* Minimalist Logo */
        .logo-container {
            width: 80px;
            height: 80px;
            margin: 0 auto 30px;
            position: relative;
            border-radius: 20px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
        }

        .logo-icon {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 2px;
            width: 100%;
            height: 100%;
        }

        .chart-bars {
            display: flex;
            align-items: end;
            gap: 3px;
            height: 24px;
        }

        .bar {
            width: 4px;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 2px;
            animation: barPulse 2s ease-in-out infinite;
        }

        .bar1 { height: 12px; animation-delay: 0.1s; }
        .bar2 { height: 18px; animation-delay: 0.2s; }
        .bar3 { height: 8px; animation-delay: 0.3s; }
        .bar4 { height: 20px; animation-delay: 0.4s; }
        .bar5 { height: 14px; animation-delay: 0.5s; }

        @keyframes barPulse {
            0%, 100% { opacity: 0.7; transform: scaleY(0.8); }
            50% { opacity: 1; transform: scaleY(1.2); }
        }

        .chart-dots {
            display: flex;
            gap: 2px;
            margin-top: 4px;
        }

        .dot {
            width: 3px;
            height: 3px;
            background: rgba(255, 255, 255, 0.8);
            border-radius: 50%;
            animation: dotBlink 1.5s ease-in-out infinite;
        }

        .dot:nth-child(1) { animation-delay: 0s; }
        .dot:nth-child(2) { animation-delay: 0.3s; }
        .dot:nth-child(3) { animation-delay: 0.6s; }

        @keyframes dotBlink {
            0%, 100% { opacity: 0.5; }
            50% { opacity: 1; }
        }


        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Clean Typography */
        .loading-text {
            font-size: 20px;
            font-weight: 600;
            color: #1f2937;
            margin-bottom: 8px;
            letter-spacing: -0.5px;
        }

        .loading-subtext {
            font-size: 14px;
            color: #6b7280;
            margin-bottom: 30px;
            opacity: 0.8;
        }

        /* Modern Progress Bar */
        .progress-container {
            width: 240px;
            height: 2px;
            background: #f3f4f6;
            border-radius: 1px;
            margin: 0 auto;
            overflow: hidden;
            position: relative;
        }

        .progress-bar {
            height: 100%;
            background: linear-gradient(90deg, #667eea, #764ba2);
            border-radius: 1px;
            animation: progress 2s ease-in-out infinite;
            width: 0%;
        }

        @keyframes progress {
            0% { width: 0%; margin-left: 0%; }
            50% { width: 60%; margin-left: 20%; }
            100% { width: 0%; margin-left: 100%; }
        }

        /* Pulse animation for text */
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.6; }
        }

        .loading-text {
            animation: pulse 2s ease-in-out infinite;
        }

        /* Progress dots */
        .loading-dots {
            display: inline-block;
            position: relative;
            margin-left: 10px;
        }

        .loading-dots span {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: white;
            margin: 0 2px;
            animation: loading-dots 1.4s ease-in-out infinite both;
        }

        .loading-dots span:nth-child(1) { animation-delay: -0.32s; }
        .loading-dots span:nth-child(2) { animation-delay: -0.16s; }
        .loading-dots span:nth-child(3) { animation-delay: 0s; }

        @keyframes loading-dots {
            0%, 80%, 100% {
                transform: scale(0);
                opacity: 0.5;
            }
            40% {
                transform: scale(1);
                opacity: 1;
            }
        }

        /* Button Loading Animation */
        .btn-loading {
            position: relative;
            pointer-events: none;
        }

        .btn-loading::after {
            content: '';
            position: absolute;
            width: 16px;
            height: 16px;
            margin: auto;
            border: 2px solid transparent;
            border-top-color: currentColor;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
        }

        /* Additional styling from original for data presentation */
        .date-block { margin-bottom: 32px; background: #fff; border-radius: 8px; box-shadow: 0 2px 8px #e3e8ee; padding: 18px; }

        /* Debug Console Styles */
        .debug-console {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 450px;
            max-height: 600px;
            background: rgba(26, 32, 44, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 12px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
            z-index: 1000;
            font-family: 'Courier New', monospace;
        }

        .debug-header {
            padding: 12px 16px;
            background: linear-gradient(135deg, #667eea, #764ba2);
            border-radius: 12px 12px 0 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .debug-header h3 {
            color: white;
            font-size: 14px;
            margin: 0;
            font-weight: 600;
        }

        .debug-toggle {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            padding: 4px 8px;
            border-radius: 6px;
            font-size: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .debug-toggle:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        .debug-content {
            max-height: 500px;
            overflow-y: auto;
            transition: all 0.3s ease;
        }

        .debug-content.collapsed {
            max-height: 0;
            overflow: hidden;
        }

        .debug-sections {
            padding: 16px;
            border-bottom: 1px solid #4a5568;
        }

        .debug-panel {
            background: rgba(255, 255, 255, 0.05);
            border-radius: 8px;
            padding: 12px;
            margin-bottom: 12px;
            border: 1px solid #4a5568;
        }

        .debug-panel h4 {
            color: #e2e8f0;
            font-size: 12px;
            margin-bottom: 8px;
            border-bottom: 1px solid #4a5568;
            padding-bottom: 4px;
            font-weight: 600;
        }

        .data-preview {
            max-height: 120px;
            overflow-y: auto;
            font-size: 10px;
            line-height: 1.3;
        }

        .preview-item {
            padding: 4px 8px;
            margin-bottom: 2px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            border-left: 3px solid #4a5568;
            color: #cbd5e0;
        }

        .preview-item.congele {
            border-left-color: #4299e1;
        }

        .preview-item.dry {
            border-left-color: #ed8936;
        }

        .no-data {
            color: #a0aec0;
            font-style: italic;
            text-align: center;
            padding: 8px;
            margin: 0;
        }

        /* Debug Table Styles */
        .debug-table-container {
            max-height: 200px;
            overflow-y: auto;
            border: 1px solid #4a5568;
            border-radius: 6px;
            margin: 8px 0;
        }

        .debug-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 10px;
            background: rgba(255, 255, 255, 0.02);
        }

        .debug-table th {
            background: #4a5568;
            color: #e2e8f0;
            padding: 6px 4px;
            text-align: center;
            font-weight: 600;
            border: 1px solid #2d3748;
            position: sticky;
            top: 0;
            z-index: 10;
        }

        .debug-table td {
            padding: 4px 4px;
            text-align: center;
            border: 1px solid #4a5568;
            color: #cbd5e0;
            background: rgba(255, 255, 255, 0.03);
        }

        .debug-table tbody tr:hover {
            background: rgba(255, 255, 255, 0.08);
        }

        .debug-table td.product-name {
            text-align: left;
            font-weight: 500;
            max-width: 120px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        /* Preview Controls Styles */
        .preview-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            flex-wrap: wrap;
            gap: 10px;
        }

        .preview-controls {
            display: flex;
            align-items: center;
            gap: 15px;
            flex-wrap: wrap;
        }

        .preview-toggle-group {
            display: flex;
            gap: 0;
            border: 1px solid #d1d5db;
            border-radius: 6px;
            overflow: hidden;
            background: white;
        }

        .preview-toggle {
            padding: 6px 12px;
            border: none;
            background: #f9fafb;
            color: #6b7280;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            transition: all 0.2s ease;
            border-right: 1px solid #e5e7eb;
        }

        .preview-toggle:last-child {
            border-right: none;
        }

        .preview-toggle:hover {
            background: #f3f4f6;
            color: #374151;
        }

        .preview-toggle.active {
            background: #3b82f6;
            color: white;
            box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
        }

        .minimize-btn {
            padding: 6px 12px;
            border: 1px solid #d1d5db;
            border-radius: 6px;
            background: #f9fafb;
            color: #6b7280;
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            transition: all 0.2s ease;
        }

        .minimize-btn:hover {
            background: #f3f4f6;
            color: #374151;
        }

        .preview-content {
            max-height: 1000px;
            transition: max-height 0.3s ease, opacity 0.3s ease;
            overflow: hidden;
            opacity: 1;
        }

        .preview-content.minimized {
            max-height: 0 !important;
            opacity: 0 !important;
        }

        .preview-tab-content {
            display: none;
        }

        .preview-tab-content.active {
            display: block;
        }

        .debug-table td.total-cell {
            font-weight: 600;
            color: #4299e1;
        }

        .debug-table td.credit-cell {
            font-weight: 600;
            color: #f6ad55;
        }

        .debug-summary {
            background: rgba(255, 255, 255, 0.05);
            border-radius: 6px;
            padding: 8px;
            margin-top: 8px;
            border: 1px solid #4a5568;
        }

        .site-totals {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
            gap: 6px;
            margin-top: 6px;
        }

        .site-total-item {
            background: rgba(66, 153, 225, 0.2);
            border-radius: 4px;
            padding: 4px 6px;
            text-align: center;
            font-size: 10px;
            color: #90cdf4;
            border: 1px solid #4299e1;
        }

        .site-total-item.credit {
            background: rgba(246, 173, 85, 0.2);
            color: #fbd38d;
            border-color: #f6ad55;
        }

        .debug-controls {
            padding: 12px 16px;
            background: rgba(255, 255, 255, 0.05);
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
            align-items: center;
        }

        .debug-btn {
            background: #4299e1;
            color: white;
            border: none;
            padding: 6px 12px;
            border-radius: 6px;
            font-size: 11px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .debug-btn:hover {
            background: #3182ce;
            transform: translateY(-1px);
        }

        .debug-btn.secondary {
            background: #718096;
        }

        .debug-btn.secondary:hover {
            background: #4a5568;
        }

        .debug-status {
            flex: 1;
            text-align: right;
            font-size: 11px;
            color: #a0aec0;
        }

        .debug-log {
            padding: 16px;
            max-height: 300px;
            overflow-y: auto;
        }

        .debug-log h4 {
            color: #e2e8f0;
            font-size: 12px;
            margin-bottom: 8px;
            border-bottom: 1px solid #4a5568;
            padding-bottom: 4px;
        }

        .log-content {
            font-size: 11px;
            line-height: 1.4;
        }

        .log-entry {
            margin-bottom: 4px;
            padding: 4px 8px;
            border-radius: 4px;
            border-left: 3px solid #4a5568;
        }

        .log-entry.info {
            background: rgba(66, 153, 225, 0.1);
            border-left-color: #4299e1;
            color: #90cdf4;
        }

        .log-entry.success {
            background: rgba(72, 187, 120, 0.1);
            border-left-color: #48bb78;
            color: #9ae6b4;
        }

        .log-entry.warning {
            background: rgba(237, 137, 54, 0.1);
            border-left-color: #ed8936;
            color: #fbd38d;
        }

        .log-entry.error {
            background: rgba(245, 101, 101, 0.1);
            border-left-color: #f56565;
            color: #feb2b2;
        }

        @media (max-width: 768px) {
            .debug-console {
                width: calc(100% - 40px);
                right: 20px;
                left: 20px;
            }
        }

/* Admin Control Panel Styles */
.admin-message-area {
    margin-top: 20px;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    display: none; /* Initially hidden */
    border: 1px solid transparent;
}

.msg-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
    display: block;
}

.msg-error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
    display: block;
}

.msg-processing {
    background-color: #cce5ff;
    color: #004085;
    border-color: #b8daff;
    display: block;
}

/* Button Loader Animation */
.download-btn .loader {
    width: 12px;
    height: 12px;
    border: 2px solid #FFF;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
    margin-right: 5px;
    vertical-align: middle;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}