/* NOTE: Analysis dashboard styles have been hidden as it's not needed for current focus on PDF generation */
:root {
            --color-background: #f4f7fb;
            --color-surface: #ffffff;
            --color-surface-muted: #f9fafc;
            --color-surface-alt: #eef2ff;
            --color-border: rgba(148, 163, 184, 0.35);
            --color-text: #0f172a;
            --color-text-muted: #64748b;
            --color-text-subtle: #94a3b8;
            --color-accent: #6366f1;
            --color-accent-dark: #4338ca;
            --color-success: #10b981;
            --color-success-dark: #0d9a6a;
            --color-error: #ef4444;
            --shadow-card: 0 18px 40px -24px rgba(15, 23, 42, 0.35);
            --shadow-card-soft: 0 14px 28px -18px rgba(15, 23, 42, 0.25);
            --shadow-card-sm: 0 12px 26px -20px rgba(15, 23, 42, 0.22);
            --radius-lg: 16px;
            --radius-md: 12px;
            --radius-sm: 8px;
            --transition-base: 200ms cubic-bezier(0.22, 0.61, 0.36, 1);
            --transition-fast: 140ms cubic-bezier(0.4, 0, 0.2, 1);
        }

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

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: var(--color-background);
            color: var(--color-text);
            margin: 0;
            padding: 0;
            min-height: 100vh;
            line-height: 1.6;
            text-rendering: optimizeLegibility;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        ::selection {
            background: rgba(99, 102, 241, 0.18);
            color: var(--color-text);
        }

        p {
            line-height: 1.7;
            color: var(--color-text-muted);
        }

        .container {
            background: var(--color-surface);
            padding: 32px;
            width: 100%;
            max-width: 1040px;
            margin: 44px auto 64px;
            opacity: 0;
            transform: translateY(22px);
            transition: opacity 0.5s ease, transform 0.5s ease;
            position: relative;
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-card);
            border: 1px solid transparent;
            background-image: linear-gradient(var(--color-surface), var(--color-surface)), linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(15, 23, 42, 0.05));
            background-origin: border-box;
            background-clip: padding-box, border-box;
        }

        .app-header {
            display: flex;
            justify-content: center;
            margin-bottom: 40px;
        }

        .app-heading {
            text-align: center;
            max-width: 560px;
            display: grid;
            gap: 8px;
        }

        .app-heading h1 {
            margin-bottom: 4px;
            font-size: 2.05rem;
            color: var(--color-text);
            font-weight: 700;
            letter-spacing: -0.015em;
            text-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
            line-height: 1.3;
        }

        .app-subtitle {
            color: var(--color-text-muted);
            font-size: 0.98rem;
            line-height: 1.65;
            text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
        }

        .primary-card {
            position: relative;
            overflow: hidden;
            border-radius: var(--radius-lg);
            padding: 32px;
            margin-bottom: 32px;
            border: 1px solid rgba(99, 102, 241, 0.12);
            box-shadow: var(--shadow-card-soft);
            background: linear-gradient(160deg, rgba(99, 102, 241, 0.12) 0%, rgba(16, 185, 129, 0.08) 100%);
        }

        .primary-card::after {
            content: '';
            position: absolute;
            inset: 0;
            pointer-events: none;
            background: radial-gradient(circle at 10% 10%, rgba(99, 102, 241, 0.25), transparent 60%);
            opacity: 0.45;
        }

        .primary-card:focus-within {
            border-color: rgba(99, 102, 241, 0.35);
            box-shadow: 0 24px 48px -32px rgba(79, 70, 229, 0.45);
        }

        .control-grid {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 18px;
            align-items: end;
        }

        .control-field label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: var(--color-text);
            font-size: 0.9rem;
            letter-spacing: 0.01em;
            text-transform: none;
        }

        .control-field {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .control-field input,
        .control-field select {
            width: 100%;
            padding: 12px 14px;
            border-radius: var(--radius-md);
            border: 1px solid rgba(148, 163, 184, 0.55);
            background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
            font-size: 0.97rem;
            color: var(--color-text);
            transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
            box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.06);
        }

        .control-field input:focus,
        .control-field select:focus {
            border-color: rgba(99, 102, 241, 0.85);
            box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
            transform: translateY(-1px);
            outline: none;
        }

        .control-field select {
            appearance: none;
            -webkit-appearance: none;
            -moz-appearance: none;
            background-image: linear-gradient(45deg, transparent 50%, var(--color-text-subtle) 50%),
                linear-gradient(135deg, var(--color-text-subtle) 50%, transparent 50%),
                linear-gradient(90deg, transparent 0%, transparent 100%);
            background-position: calc(100% - 18px) calc(50% + 3px), calc(100% - 12px) calc(50% + 3px), 100% 0;
            background-size: 7px 7px, 7px 7px, 3.5rem 3.5rem;
            background-repeat: no-repeat;
        }

        .control-field input[type="date"] {
            position: relative;
            color-scheme: light;
        }

        .control-field input[type="date"]::-webkit-calendar-picker-indicator {
            filter: invert(35%);
            opacity: 0.85;
            transition: opacity var(--transition-fast);
        }

        .control-field input[type="date"]:hover::-webkit-calendar-picker-indicator {
            opacity: 1;
        }

        .control-field:focus-within label {
            color: var(--color-accent);
        }

        .control-field input::placeholder,
        .control-field select::placeholder {
            color: var(--color-text-subtle);
        }

        .control-field input:disabled,
        .control-field select:disabled {
            background: rgba(248, 250, 252, 0.8);
            cursor: not-allowed;
            color: rgba(100, 116, 139, 0.8);
            box-shadow: none;
        }

        .primary-action {
            display: flex;
            justify-content: flex-end;
            align-items: center;
        }

        button,
        .download-btn,
        .developer-tools-button {
            font-family: inherit;
            transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base), filter var(--transition-fast);
            will-change: transform, box-shadow;
        }

        button:disabled,
        .download-btn:disabled {
            cursor: not-allowed;
            filter: grayscale(0.35) brightness(0.96);
            transform: none !important;
            box-shadow: none !important;
            opacity: 0.75;
        }

        .primary-download-btn {
            width: 100%;
            padding: 14px 20px;
            border: none;
            border-radius: var(--radius-md);
            font-size: 1rem;
            font-weight: 600;
            background: #2b64f6;
            color: #ffffff;
            cursor: pointer;
            box-shadow: 0 16px 28px -18px rgba(43, 100, 246, 0.55);
            position: relative;
            text-shadow: 0 1px 2px rgba(15, 23, 42, 0.15);
        }

        .primary-download-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 22px 40px -20px rgba(43, 100, 246, 0.55);
            filter: brightness(1.04);
        }

        .primary-download-btn:focus-visible {
            outline: 3px solid rgba(43, 100, 246, 0.35);
            outline-offset: 3px;
        }

        .primary-download-btn:active {
            transform: translateY(0);
            box-shadow: 0 12px 24px -18px rgba(43, 100, 246, 0.55);
        }

        .primary-hint {
            margin-top: 18px;
            color: var(--color-text-muted);
            font-size: 0.85rem;
            letter-spacing: 0.01em;
        }

        .developer-access {
            display: flex;
            justify-content: flex-end;
            margin-bottom: 18px;
        }

        .developer-tools-button {
            padding: 10px 20px;
            border-radius: var(--radius-md);
            border: 1px solid rgba(99, 102, 241, 0.25);
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.16) 0%, rgba(99, 102, 241, 0.06) 100%);
            color: var(--color-accent-dark);
            font-weight: 600;
            cursor: pointer;
            box-shadow: 0 14px 30px -20px rgba(67, 56, 202, 0.55);
        }

        .developer-tools-button.unlocked {
            border-color: rgba(16, 185, 129, 0.3);
            background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0.08) 100%);
            color: #0f766e;
        }

        .developer-tools-button:hover {
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.24) 0%, rgba(99, 102, 241, 0.12) 100%);
            color: var(--color-accent);
            transform: translateY(-1px);
        }

        .developer-tools-button.unlocked:hover {
            background: linear-gradient(135deg, rgba(16, 185, 129, 0.28) 0%, rgba(16, 185, 129, 0.12) 100%);
            color: #047857;
        }

        .developer-tools-button:focus-visible {
            outline: 3px solid rgba(99, 102, 241, 0.35);
            outline-offset: 2px;
        }

        .developer-tools-button:active {
            transform: translateY(0);
            box-shadow: 0 10px 20px -18px rgba(67, 56, 202, 0.45);
        }

        .developer-tools-panel {
            border: 1px solid rgba(148, 163, 184, 0.35);
            border-radius: var(--radius-lg);
            padding: 26px 28px;
            background: var(--color-surface);
            box-shadow: var(--shadow-card-soft);
            transition: box-shadow var(--transition-base), border-color var(--transition-base);
        }

        .developer-tools-panel:not([hidden]) {
            animation: fade-slide-in 260ms ease;
        }

        .developer-tools-panel[hidden] {
            display: none !important;
        }

        .developer-hint {
            margin-bottom: 20px;
            color: var(--color-text-muted);
            font-size: 0.87rem;
            letter-spacing: 0.01em;
        }

        .dev-details {
            border: 1px solid rgba(226, 232, 240, 0.9);
            border-radius: var(--radius-md);
            margin-bottom: 18px;
            background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(237, 242, 255, 0.85) 100%);
            overflow: hidden;
            transition: border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
        }

        .dev-details:last-of-type {
            margin-bottom: 0;
        }

        .dev-details[open] > summary {
            border-bottom: 1px solid rgba(148, 163, 184, 0.25);
        }

        .dev-details summary {
            cursor: pointer;
            padding: 16px 18px;
            font-weight: 600;
            color: var(--color-text);
            list-style: none;
            position: relative;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: color var(--transition-fast), background var(--transition-fast);
        }

        .dev-details summary::-webkit-details-marker {
            display: none;
        }

        .dev-details summary::after {
            content: '\25BC';
            position: absolute;
            right: 20px;
            top: 50%;
            transform: translateY(-50%) rotate(0deg);
            transition: transform var(--transition-fast), color var(--transition-fast);
            font-size: 0.75rem;
            color: var(--color-text-subtle);
        }

        .dev-details[open] summary::after {
            transform: translateY(-50%) rotate(-180deg);
            color: var(--color-accent);
        }

        .dev-details-body {
            padding: 20px;
            background: var(--color-surface);
            animation: dev-section-reveal 240ms ease both;
            display: grid;
            gap: 18px;
        }

        .dev-details:hover {
            box-shadow: 0 16px 34px -26px rgba(15, 23, 42, 0.35);
            transform: translateY(-1px);
        }

        .dev-details summary:hover {
            background: rgba(99, 102, 241, 0.08);
            color: var(--color-accent);
        }

        .dev-details summary:focus-visible {
            outline: 3px solid rgba(99, 102, 241, 0.28);
            outline-offset: 3px;
        }

        @keyframes dev-section-reveal {
            from {
                opacity: 0;
                transform: translateY(-8px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @media (max-width: 960px) {
            .container {
                padding: 26px;
                margin: 32px auto 48px;
            }

            .control-grid {
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 16px;
            }

            .primary-action {
                grid-column: 1 / -1;
            }
        }

        @media (max-width: 640px) {
            .container {
                padding: 18px;
                margin: 24px 0 40px;
            }

            .primary-card {
                padding: 22px;
            }

            .control-grid {
                grid-template-columns: 1fr;
                gap: 14px;
            }

            .primary-action {
                width: 100%;
            }
        }

        .dev-section-toggle {
            position: absolute;
            top: 16px;
            right: 16px;
            padding: 8px 16px;
            font-size: 0.75rem;
            font-weight: 600;
            letter-spacing: 0.02em;
            border: none;
            border-radius: 999px;
            background: #1f2937;
            color: #ffffff;
            cursor: pointer;
            z-index: 20;
            box-shadow: 0 4px 12px rgba(17, 24, 39, 0.15);
            transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
        }

        .dev-section-toggle:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 16px rgba(17, 24, 39, 0.2);
            background: #111827;
        }

        .dev-section-toggle[aria-pressed="true"] {
            background: #10b981;
            box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25);
        }

        .dev-section-toggle:focus-visible {
            outline: 2px solid #4338ca;
            outline-offset: 2px;
        }

        .dev-hidden-section {
            display: none !important;
        }

        .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: var(--color-surface);
            border: 1px solid rgba(226, 232, 240, 0.85);
            border-radius: var(--radius-md);
            padding: 22px;
            margin-bottom: 22px;
            box-shadow: var(--shadow-card-sm);
            transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
        }
        .report-section:hover {
            transform: translateY(-1px);
            box-shadow: 0 18px 32px -24px rgba(15, 23, 42, 0.35);
            border-color: rgba(99, 102, 241, 0.18);
        }

        .report-section:focus-within {
            border-color: rgba(99, 102, 241, 0.28);
            box-shadow: 0 20px 36px -26px rgba(79, 70, 229, 0.32);
        }
        .report-section h3 {
            color: var(--color-text);
            font-size: 1rem;
            font-weight: 600;
            margin-bottom: 16px;
            padding-bottom: 12px;
            border-bottom: 1px solid rgba(148, 163, 184, 0.25);
            text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
        }
        .button-group {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 14px;
        }
        /* Force single-row fixed columns for primary controls */
        .button-group.button-row-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
        .button-group.button-row-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

        /* Preview Section Styles */
        .preview-section {
            background: var(--color-surface);
            border: 1px solid rgba(226, 232, 240, 0.85);
            border-radius: var(--radius-md);
            padding: 22px;
            margin-bottom: 24px;
            box-shadow: var(--shadow-card-sm);
            transition: transform var(--transition-base), box-shadow var(--transition-base);
        }
        .preview-section:hover { transform: translateY(-1px); box-shadow: 0 18px 34px -26px rgba(15, 23, 42, 0.3); }
        .preview-section h3 {
            color: var(--color-text);
            font-size: 1rem;
            font-weight: 600;
            margin-bottom: 16px;
            padding-bottom: 12px;
            border-bottom: 1px solid rgba(148, 163, 184, 0.25);
            text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
        }
        .preview-section h3 span {
            color: var(--color-accent);
            font-weight: 700;
        }
        .preview-stats {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 16px;
            margin-bottom: 20px;
        }
        .stat-card {
            background: linear-gradient(180deg, rgba(248, 250, 252, 0.9) 0%, rgba(226, 232, 240, 0.6) 100%);
            border: 1px solid rgba(226, 232, 240, 0.9);
            border-radius: var(--radius-sm);
            padding: 14px;
            text-align: center;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
        }
        .stat-label {
            display: block;
            font-size: 0.75rem;
            color: var(--color-text-subtle);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 4px;
        }
        .stat-value {
            display: block;
            font-size: 1.55rem;
            font-weight: 700;
            color: var(--color-text);
            text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7);
        }
        .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: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(226, 232, 240, 0.6) 100%);
            padding: 8px;
            text-align: center;
            font-weight: 600;
            color: var(--color-text);
            border-bottom: 1px solid rgba(226, 232, 240, 0.8);
            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: rgba(99, 102, 241, 0.05); }
        .preview-table td:first-child {
            text-align: left;
            font-weight: 500;
        }
        .preview-note {
            padding: 8px;
            text-align: center;
            font-size: 0.75rem;
            color: var(--color-text-subtle);
            background: rgba(248, 250, 252, 0.8);
            border-top: 1px solid rgba(148, 163, 184, 0.2);
        }

        .download-btn {
            background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
            color: #ffffff;
            border: none;
            padding: 12px 20px;
            border-radius: var(--radius-md);
            font-size: 0.92rem;
            font-weight: 600;
            cursor: pointer;
            text-align: center;
            box-shadow: 0 10px 20px -14px rgba(79, 70, 229, 0.6);
        }

        .download-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 16px 28px -18px rgba(79, 70, 229, 0.55);
            filter: brightness(1.03);
        }

        .download-btn:active {
            transform: translateY(0);
            box-shadow: 0 10px 20px -18px rgba(79, 70, 229, 0.55);
        }

        .download-btn:focus-visible {
            outline: 3px solid rgba(99, 102, 241, 0.35);
            outline-offset: 3px;
        }

        .download-btn.secondary {
            background: linear-gradient(135deg, #10b981 0%, #059669 100%);
            box-shadow: 0 12px 22px -18px rgba(16, 185, 129, 0.55);
        }
        .download-btn.secondary:hover {
            box-shadow: 0 18px 32px -20px rgba(16, 185, 129, 0.55);
            filter: brightness(1.04);
        }

        .download-btn.json-btn {
            background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
            box-shadow: 0 12px 22px -18px rgba(245, 158, 11, 0.45);
        }
        .download-btn.json-btn:hover { filter: brightness(1.05); box-shadow: 0 18px 34px -22px rgba(245, 158, 11, 0.45); }

        .download-btn.sample-btn {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            box-shadow: 0 12px 22px -18px rgba(239, 68, 68, 0.45);
        }
        .download-btn.sample-btn:hover { filter: brightness(1.05); box-shadow: 0 18px 34px -22px rgba(239, 68, 68, 0.45); }

        /* Sales list styling */
        table { border-collapse: collapse; width: 100%; margin-top: 20px; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-card-sm); background: var(--color-surface); }
        th, td { padding: 8px 12px; text-align: left; border: 1px solid rgba(226, 232, 240, 0.8); }
        th { background: linear-gradient(180deg, rgba(226, 232, 240, 0.7) 0%, rgba(226, 232, 240, 0.45) 100%); color: var(--color-text); font-weight: 600; font-size: 0.9rem; }
        tr { transition: background var(--transition-fast); }
        tr:hover { background: rgba(99, 102, 241, 0.06); }
        .no-sales { color: var(--color-text-muted); font-style: italic; text-align: center; padding: 40px; font-size: 1.05rem; margin-top: 8px; }

        /* SLEEK PROFESSIONAL LOADING SCREEN */
        .loading-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: radial-gradient(circle at top, rgba(99, 102, 241, 0.15), rgba(255, 255, 255, 0.9));
            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 rgba(148, 163, 184, 0.35);
            border-radius: var(--radius-sm);
            overflow: hidden;
            background: linear-gradient(90deg, rgba(248, 250, 252, 0.95) 0%, rgba(237, 242, 255, 0.8) 100%);
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
        }

        .preview-toggle {
            padding: 6px 12px;
            border: none;
            background: transparent;
            color: var(--color-text-subtle);
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
            transition: background var(--transition-fast), color var(--transition-fast);
            border-right: 1px solid rgba(226, 232, 240, 0.7);
        }

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

        .preview-toggle:hover {
            background: rgba(99, 102, 241, 0.12);
            color: var(--color-accent-dark);
        }

        .preview-toggle.active {
            background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(99, 102, 241, 0.85) 100%);
            color: #ffffff;
            box-shadow: inset 0 1px 4px rgba(15, 23, 42, 0.15);
        }

        .preview-toggle:focus-visible,
        .minimize-btn:focus-visible {
            outline: 2px solid rgba(99, 102, 241, 0.35);
            outline-offset: 3px;
        }

        .minimize-btn {
            padding: 6px 12px;
            border: 1px solid rgba(148, 163, 184, 0.4);
            border-radius: var(--radius-sm);
            background: linear-gradient(180deg, rgba(248, 250, 252, 0.95) 0%, rgba(226, 232, 240, 0.7) 100%);
            color: var(--color-text-subtle);
            cursor: pointer;
            font-size: 12px;
            font-weight: 500;
            transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
        }

        .minimize-btn:hover {
            background: rgba(99, 102, 241, 0.12);
            color: var(--color-accent);
            transform: translateY(-1px);
        }

        /* One‑shot overlay (clean, professional) */
        .one-shot-overlay {
            position: fixed;
            inset: 0;
            background: rgba(17, 24, 39, 0.45);
            backdrop-filter: blur(1px);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
        }
        .one-shot-card {
            width: 320px;
            padding: 20px 22px;
            border-radius: var(--radius-md);
            background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
            border: 1px solid rgba(226, 232, 240, 0.9);
            box-shadow: 0 22px 46px -28px rgba(15, 23, 42, 0.55);
            color: #111827;
            text-align: center;
        }
        .one-shot-card:before { display: none; }
        .one-shot-anim { margin-bottom: 8px; }
        .one-shot-ring {
            width: 36px;
            height: 36px;
            margin: 0 auto 10px;
            border-radius: 50%;
            border: 3px solid #cbd5e1;
            border-top-color: #3b82f6;
            animation: spin 0.8s linear infinite;
        }
        @keyframes spin { to { transform: rotate(360deg); } }
        .one-shot-pulse { display:flex; gap:4px; justify-content:center; }
        .one-shot-pulse span {
            width: 6px; height: 6px; border-radius: 50%;
            background: #9ca3af;
            animation: dotFade 1.2s ease-in-out infinite;
            opacity: .4;
        }
        .one-shot-pulse span:nth-child(2){ animation-delay: .15s; }
        .one-shot-pulse span:nth-child(3){ animation-delay: .3s; }
        .one-shot-pulse span:nth-child(4){ animation-delay: .45s; }
        .one-shot-pulse span:nth-child(5){ animation-delay: .6s; }
        @keyframes dotFade { 0%,100%{ opacity:.3 } 50%{ opacity:1 } }
        .one-shot-status { font-size: 14px; color: #374151; letter-spacing: .2px; }

        .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: 14px 18px;
    border-radius: var(--radius-md);
    text-align: center;
    font-weight: 600;
    display: none; /* Initially hidden */
    border: 1px solid transparent;
    box-shadow: 0 12px 24px -20px rgba(15, 23, 42, 0.4);
    transition: transform var(--transition-base), box-shadow var(--transition-base), opacity var(--transition-base);
}

.primary-status {
    margin-top: 16px;
    font-size: 0.9rem;
}

.main-view { display: none; }
.main-view.active { display: block; }

#analytics-view .container {
    width: calc(100% - 48px);
    max-width: 1360px;
    margin: 32px auto 64px;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.analytics-container .app-header {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}
.analytics-container .analytics-controls {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}
.analytics-controls .control-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}
.analytics-controls select,
.analytics-controls input {
    min-width: 140px;
}
.analytics-search-field input {
    min-width: 220px;
}
.analytics-range-toggle {
    display: flex;
    gap: 6px;
}
.range-btn {
    border: 1px solid rgba(15, 23, 42, 0.2);
    background: rgba(15, 23, 42, 0.04);
    color: #0f172a;
    border-radius: 999px;
    padding: 6px 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.range-btn:hover { background: rgba(15, 23, 42, 0.1); }
.range-btn.active {
    background: linear-gradient(90deg, #4f46e5, #3b82f6);
    color: #fff;
    border-color: transparent;
}
.analytics-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(15, 23, 42, 0.12);
    padding: 24px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-card-sm);
}
.analytics-card h3 { margin-bottom: 12px; }
.analytics-flex { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.analytics-column { border: 1px dashed rgba(15, 23, 42, 0.2); border-radius: 12px; padding: 16px; background: rgba(15, 23, 42, 0.02); }
.analytics-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.analytics-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; background: rgba(17, 24, 39, 0.05); padding: 10px 14px; border-radius: 10px; }
.analytics-list li > div { display: flex; flex-direction: column; gap: 2px; }
.analytics-list small { color: rgba(17, 24, 39, 0.65); font-size: 0.78rem; }
.analytics-list span { font-weight: 700; color: #111827; }
.analytics-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.analytics-metric { border: 1px solid rgba(15, 23, 42, 0.12); border-radius: 12px; padding: 18px; background: rgba(255, 255, 255, 0.95); box-shadow: 0 12px 30px -24px rgba(15, 23, 42, 0.45); }
.analytics-metric span { display: block; font-size: 2rem; font-weight: 700; color: #111827; }
.analytics-site-table table { width: 100%; border-collapse: collapse; }
.analytics-site-table th,
.analytics-site-table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid rgba(15, 23, 42, 0.08); font-size: 0.92rem; }
.analytics-site-table tr:last-child td { border-bottom: none; }
.analytics-site-table th { color: #0f172a; font-weight: 600; background: rgba(15, 23, 42, 0.03); }
.analytics-bar { width: 100%; height: 8px; border-radius: 999px; background: rgba(15, 23, 42, 0.08); overflow: hidden; }
.analytics-bar span { display: block; height: 100%; background: linear-gradient(90deg, #6366f1, #3b82f6); border-radius: inherit; }
.analytics-empty { color: rgba(15, 23, 42, 0.6); font-style: italic; }

/* Top Navigation */
.top-nav {
    width: 100%;
    background: #111827;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    box-shadow: 0 10px 24px -18px rgba(15, 23, 42, 0.45);
}
.top-nav .brand {
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.02em;
}
.nav-tabs {
    display: flex;
    gap: 10px;
}
.nav-tab {
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    color: #cbd5f5;
    padding: 6px 16px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.nav-tab:hover { background: rgba(255, 255, 255, 0.12); }
.nav-tab.active {
    background: #f1f5f9;
    color: #111827;
}

.msg-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0.06) 100%);
    color: var(--color-success-dark);
    border-color: rgba(16, 185, 129, 0.25);
    display: block;
}

.msg-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.18) 0%, rgba(239, 68, 68, 0.05) 100%);
    color: #b91c1c;
    border-color: rgba(239, 68, 68, 0.3);
    display: block;
}

.msg-processing {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18) 0%, rgba(59, 130, 246, 0.05) 100%);
    color: #1d4ed8;
    border-color: rgba(59, 130, 246, 0.28);
    display: block;
}

/* Button Loader Animation */
.download-btn .loader,
.primary-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);
    }
}

@keyframes fade-slide-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Date Range Processing Styles */
.date-range-controls {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 15px;
}

.date-range-controls .date-input-wrapper {
    margin-bottom: 0;
}

.date-range-progress {
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    margin-top: 15px;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: #667eea;
    width: 0%;
    transition: width 0.3s ease;
}

.date-range-status {
    font-size: 0.9rem;
    color: #374151;
    text-align: center;
    font-weight: 500;
}

/* Cache bust: Fri Sep  5 17:02:31 WAT 2025 */
