/* =============================================
   ML Skener – Účtovný Portál  |  styles.css
   Medical Logistic © 2026
   MAGEPRIKLAD-inspired Premium Design
   ============================================= */

/* ============================================================================
   DESIGN TOKENS  (inspired by MAGE SCAN License Manager PRO)
   ============================================================================ */
:root {
    /* Primary palette */
    --ml-primary:          #6366f1;
    --ml-primary-hover:    #4f46e5;
    --ml-primary-light:    rgba(99, 102, 241, 0.08);
    --ml-primary-bg:       rgba(99, 102, 241, 0.12);

    /* Accents */
    --ml-success:          #10b981;
    --ml-success-light:    rgba(16, 185, 129, 0.08);
    --ml-warning:          #f59e0b;
    --ml-warning-light:    rgba(245, 158, 11, 0.08);
    --ml-danger:           #ef4444;
    --ml-danger-light:     rgba(239, 68, 68, 0.08);
    --ml-purple:           #8b5cf6;
    --ml-purple-light:     rgba(139, 92, 246, 0.08);
    --ml-cyan:             #06b6d4;
    --ml-cyan-light:       rgba(6, 182, 212, 0.08);
    --ml-orange:           #f97316;
    --ml-orange-light:     rgba(249, 115, 22, 0.08);

    /* Gradients */
    --ml-gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --ml-gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --ml-gradient-danger:  linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --ml-gradient-dark:    linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    --ml-gradient-header:  linear-gradient(135deg, #1a1c3a 0%, #2d1b69 40%, #1a1c3a 100%);

    /* Surfaces */
    --ml-bg:               #f8fafc;
    --ml-card-bg:          #ffffff;
    --ml-card-bg-alt:      #f8fafc;
    --ml-sidebar-bg:       #0f172a;

    /* Text */
    --ml-text:             #1e293b;
    --ml-text-secondary:   #475569;
    --ml-text-muted:       #94a3b8;

    /* Borders */
    --ml-border:           #e2e8f0;
    --ml-border-light:     #f1f5f9;

    /* Shadows */
    --ml-shadow-xs:  0 1px 2px rgba(0, 0, 0, 0.04);
    --ml-shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --ml-shadow:     0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --ml-shadow-md:  0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --ml-shadow-lg:  0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);

    /* Radii */
    --ml-radius-xs:   4px;
    --ml-radius-sm:   6px;
    --ml-radius:      10px;
    --ml-radius-lg:   14px;
    --ml-radius-full: 9999px;

    /* Transition */
    --ml-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing */
    --ml-gap:      20px;
    --ml-gap-sm:   14px;
    --ml-gap-lg:   28px;
}

/* ============================================================================
   RESET & BASE
   ============================================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--ml-bg);
    color: var(--ml-text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    line-height: 1.6;
}

/* ============================================================================
   LAYOUT
   ============================================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================================
   SIDEBAR — Dark premium sidebar
   ============================================================================ */
.sidebar {
    width: 260px;
    background:
        radial-gradient(circle at 20% 15%, rgba(56, 189, 248, 0.18), transparent 40%),
        radial-gradient(circle at 80% 85%, rgba(59, 130, 246, 0.14), transparent 45%),
        linear-gradient(180deg, #050816 0%, #0b1220 45%, #0f172a 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        10px 0 35px rgba(0, 0, 0, 0.35),
        inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.sidebar-brand {
    padding: 24px 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: relative;
}

/* Subtle glow behind brand */
.sidebar-brand::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 60px;
    background: radial-gradient(ellipse, rgba(99, 102, 241, 0.15), transparent 70%);
    pointer-events: none;
}

.sidebar-brand h1 {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}

.sidebar-brand h1 .brand-icon {
    width: 214px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.sidebar-brand h1 .brand-icon img {
    max-width: 100%;
    height: auto;
}

.sidebar-brand p {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
    overflow-y: auto;
}

.sidebar-nav .nav-section {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: #475569;
    padding: 16px 12px 8px;
	display: none;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--ml-transition);
    font-size: 15px;
    font-weight: 500;
    color: #94a3b8;
    text-decoration: none;
    margin-bottom: 2px;
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
}

.nav-item.active {
    background: var(--ml-primary-bg);
    color: #a5b4fc;
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--ml-gradient-primary);
    border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--ml-gradient-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--ml-radius-full);
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #475569;
    transition: background 0.3s;
    flex-shrink: 0;
}

.status-dot.online {
    background: var(--ml-success);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    animation: mlPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-dot.offline { background: var(--ml-danger); }

@keyframes mlPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
}

/* ============================================================================
   TOP BAR — Clean, minimal with blur
   ============================================================================ */
.topbar {
    border-bottom: 1px solid var(--ml-border);
    padding: 0 32px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.85);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left h2 {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: var(--ml-text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-time {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    color: var(--ml-text-muted);
    font-weight: 500;
    background: var(--ml-card-bg-alt);
    padding: 5px 12px;
    border-radius: var(--ml-radius-sm);
    border: 1px solid var(--ml-border-light);
}

/* ============================================================================
   PAGE CONTENT
   ============================================================================ */
.page-content {
    padding: 28px 32px;
}

/* ============================================================================
   STAT CARDS — Colored left border, icon box, large value
   ============================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--ml-gap);
    margin-bottom: var(--ml-gap-lg);
}

.stat-card {
    background: var(--ml-card-bg);
    border: 1px solid var(--ml-border-light);
    border-radius: var(--ml-radius);
    padding: 22px 24px;
    transition: var(--ml-transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--ml-shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 0 4px 4px 0;
}

.stat-card:hover {
    box-shadow: var(--ml-shadow-md);
    transform: translateY(-2px);
}

/* Color variants via data-color attribute */
.stat-card[data-color="primary"]::before { background: var(--ml-gradient-primary); }
.stat-card[data-color="success"]::before { background: var(--ml-gradient-success); }
.stat-card[data-color="warning"]::before { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-card[data-color="purple"]::before  { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-card[data-color="cyan"]::before    { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.stat-card[data-color="danger"]::before  { background: var(--ml-gradient-danger); }
.stat-card[data-color="orange"]::before  { background: linear-gradient(135deg, #f97316, #ea580c); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--ml-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    transition: var(--ml-transition);
}

.stat-card:hover .stat-icon {
    transform: scale(1.05);
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 12px;
    color: var(--ml-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-trend {
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: var(--ml-radius-full);
    margin-top: 6px;
}

.stat-trend.up {
    color: #047857;
    background: var(--ml-success-light);
}

.stat-trend.down {
    color: #b91c1c;
    background: var(--ml-danger-light);
}

/* ============================================================================
   CHART CARDS
   ============================================================================ */
.charts-row {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: var(--ml-gap);
    margin-bottom: var(--ml-gap-lg);
}

.chart-card {
    background: var(--ml-card-bg);
    border: 1px solid var(--ml-border-light);
    border-radius: var(--ml-radius);
    padding: 24px;
    box-shadow: var(--ml-shadow-sm);
    transition: var(--ml-transition);
}

.chart-card:hover {
    box-shadow: var(--ml-shadow);
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.chart-card-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--ml-text);
    letter-spacing: -0.2px;
}

.chart-canvas-wrap {
    position: relative;
    width: 100%;
    height: 240px;
    max-height: 240px;
}

.chart-canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: 240px;
}

/* ============================================================================
   CARDS & PANELS
   ============================================================================ */
.card {
    background: var(--ml-card-bg);
    border: 1px solid var(--ml-border-light);
    border-radius: var(--ml-radius);
    overflow: hidden;
    box-shadow: var(--ml-shadow-sm);
    transition: var(--ml-transition);
}

.card:hover {
    box-shadow: var(--ml-shadow);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--ml-border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ml-card-bg);
}

.card-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--ml-text);
    letter-spacing: -0.2px;
}

.card-body {
    padding: 0;
}

/* ============================================================================
   DATA TABLE — Clean, modern with hover
   ============================================================================ */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--ml-text-muted);
    padding: 14px 16px;
    text-align: left;
    background: var(--ml-card-bg-alt);
    border-bottom: 2px solid var(--ml-border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--ml-border-light);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--ml-transition);
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.03);
}

.data-table tbody tr.selected {
    background: var(--ml-primary-light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================================
   BADGES — Pill-shaped with subtle borders
   ============================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--ml-radius-full);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge-good {
    background: var(--ml-success-light);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-ok {
    background: var(--ml-warning-light);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-bad {
    background: var(--ml-danger-light);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-primary {
    background: var(--ml-primary-light);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.badge-purple {
    background: var(--ml-purple-light);
    color: #6d28d9;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-active {
    background: var(--ml-success-light);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-active::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ml-success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
    flex-shrink: 0;
}

.badge-inactive {
    background: rgba(100, 116, 139, 0.08);
    color: #64748b;
    border: 1px solid rgba(100, 116, 139, 0.15);
}

.badge-inactive::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #94a3b8;
    flex-shrink: 0;
}

/* ============================================================================
   BUTTONS — Premium gradient primary, clean secondary
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--ml-radius-sm);
    border: 1px solid var(--ml-border);
    background: var(--ml-card-bg);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--ml-text-secondary);
    cursor: pointer;
    transition: var(--ml-transition);
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.btn:hover {
    border-color: var(--ml-primary);
    color: var(--ml-primary);
    background: var(--ml-primary-light);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: var(--ml-gradient-primary);
    border: none;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    color: #fff;
    background: var(--ml-gradient-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-danger {
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--ml-danger);
}

.btn-danger:hover {
    background: var(--ml-danger-light);
    border-color: var(--ml-danger);
    color: var(--ml-danger);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 11px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ml-radius-xs);
}

.btn-live {
    background: #1e293b;
    border-color: #1e293b;
    color: #64748b;
}

.btn-live.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
    animation: pulseLive 2s infinite;
}

@keyframes pulseLive {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* ============================================================================
   INPUTS & SELECTS
   ============================================================================ */
.input {
    padding: 9px 14px;
    border: 2px solid var(--ml-border);
    border-radius: var(--ml-radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    background: var(--ml-card-bg);
    color: var(--ml-text);
    outline: none;
    transition: var(--ml-transition);
}

.input:focus {
    border-color: var(--ml-primary);
    box-shadow: 0 0 0 3px var(--ml-primary-light);
}

.input::placeholder {
    color: var(--ml-text-muted);
    font-weight: 400;
}

.select {
    padding: 9px 34px 9px 14px;
    border: 2px solid var(--ml-border);
    border-radius: var(--ml-radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    background: var(--ml-card-bg);
    color: var(--ml-text-secondary);
    cursor: pointer;
    outline: none;
    transition: var(--ml-transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.select:focus {
    border-color: var(--ml-primary);
    box-shadow: 0 0 0 3px var(--ml-primary-light);
}

/* ============================================================================
   PREVIEW PANEL — receipt image viewer
   ============================================================================ */
.receipts-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: var(--ml-gap);
}

.preview-panel {
    background: var(--ml-card-bg);
    border: 1px solid var(--ml-border-light);
    border-radius: var(--ml-radius);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 180px);
    position: sticky;
    top: 88px;
    box-shadow: var(--ml-shadow-sm);
}

.preview-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--ml-border-light);
}

.preview-header h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--ml-text);
}

.preview-meta {
    font-size: 11px;
    color: var(--ml-text-muted);
    margin-top: 6px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-weight: 500;
}

.preview-body {
    flex: 1;
    overflow: auto;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: var(--ml-card-bg-alt);
}

.preview-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--ml-radius-sm);
}

.preview-empty {
    color: var(--ml-text-muted);
    font-size: 13px;
    text-align: center;
}

.preview-empty .preview-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.3;
}

/* ============================================================================
   REPORT SECTION
   ============================================================================ */
.report-section {
    margin-bottom: var(--ml-gap-lg);
}

.report-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 14px;
}

/* ============================================================================
   SETTINGS
   ============================================================================ */
.settings-group {
    background: var(--ml-card-bg);
    border: 1px solid var(--ml-border-light);
    border-radius: var(--ml-radius);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--ml-shadow-sm);
    transition: var(--ml-transition);
}

.settings-group:hover {
    box-shadow: var(--ml-shadow);
}

.settings-group h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 18px;
    color: var(--ml-text);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--ml-border-light);
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.form-row .input { flex: 1; }

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ml-text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ============================================================================
   LOADING
   ============================================================================ */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--ml-border);
    border-top-color: var(--ml-primary);
    border-radius: 50%;
    animation: mlSpin 0.7s linear infinite;
}

@keyframes mlSpin { to { transform: rotate(360deg); } }

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--ml-text-muted);
    gap: 12px;
    font-size: 13px;
    font-weight: 500;
}

/* ============================================================================
   SETUP / LOGIN SCREEN — Dark gradient background, glassmorphism card
   ============================================================================ */
.setup-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ml-gradient-header);
    position: relative;
    overflow: hidden;
}

/* Glassmorphism background effect */
.setup-screen::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    top: 20%;
    left: 30%;
    pointer-events: none;
}

.setup-screen::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    bottom: 20%;
    right: 20%;
    pointer-events: none;
}

.setup-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--ml-radius-lg);
    padding: 44px;
    width: 420px;
    box-shadow: var(--ml-shadow-lg), 0 0 60px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.setup-card .brand-icon-large {
    width: 180px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.setup-card .brand-icon-large img {
    max-width: 100%;
    height: auto;
}

.setup-card h2 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
    color: var(--ml-text);
}

.setup-card p {
    color: var(--ml-text-secondary);
    font-size: 13px;
    margin-bottom: 28px;
    font-weight: 500;
}

.setup-input-group {
    text-align: left;
    margin-bottom: 18px;
}

.setup-input-group label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--ml-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setup-input-group .input {
    width: 100%;
    padding: 12px 16px;
    font-size: 13px;
}

.setup-error {
    color: var(--ml-danger);
    font-size: 12px;
    margin-top: 12px;
    font-weight: 600;
    display: none;
    background: var(--ml-danger-light);
    padding: 8px 14px;
    border-radius: var(--ml-radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */
.fade-in {
    animation: mlFadeIn 0.35s ease;
}

@keyframes mlFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes mlSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes mlScaleIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============================================================================
   MODAL — Backdrop blur, scale-in animation
   ============================================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: mlFadeOverlay 0.2s ease;
}

@keyframes mlFadeOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes mlConfirmFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes mlConfirmScaleIn {
    from { opacity: 0; transform: scale(0.92) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal {
    background: var(--ml-card-bg);
    border-radius: var(--ml-radius-lg);
    padding: 32px;
    width: 460px;
    max-width: 90vw;
    box-shadow: var(--ml-shadow-lg), 0 0 40px rgba(0, 0, 0, 0.1);
    animation: mlScaleIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--ml-border-light);
}

.modal h3 {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 24px;
    letter-spacing: -0.3px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--ml-border-light);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--ml-border-light);
}

/* ============================================================================
   IMAGE FULLSCREEN
   ============================================================================ */
.image-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    cursor: zoom-out;
    animation: mlFadeOverlay 0.2s ease;
}

.image-modal-overlay img {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
    border-radius: var(--ml-radius);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}

/* ============================================================================
   TOAST — Slide-in from right with colored left border
   ============================================================================ */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--ml-card-bg);
    color: var(--ml-text);
    padding: 14px 20px 14px 18px;
    border-radius: var(--ml-radius-sm);
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--ml-shadow-lg);
    animation: mlToastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1), mlToastOut 0.3s ease 2.7s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--ml-border-light);
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast-success::before { background: var(--ml-gradient-success); }
.toast-error::before   { background: var(--ml-gradient-danger); }
.toast-info::before    { background: var(--ml-gradient-primary); }

@keyframes mlToastIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes mlToastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

/* ============================================================================
   FILTER BAR
   ============================================================================ */
.filter-bar {
    display: flex;
    gap: 14px;
    align-items: center;
    background: var(--ml-card-bg);
    padding: 14px 20px;
    border-radius: var(--ml-radius);
    box-shadow: var(--ml-shadow-sm);
    margin-bottom: 18px;
    flex-wrap: wrap;
    border: 1px solid var(--ml-border-light);
}

.filter-bar .filter-count {
    font-size: 12px;
    color: var(--ml-text-muted);
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ============================================================================
   PERIOD SELECTOR (for charts)
   ============================================================================ */
.period-selector {
    display: inline-flex;
    background: var(--ml-card-bg-alt);
    border-radius: var(--ml-radius-sm);
    border: 1px solid var(--ml-border-light);
    overflow: hidden;
}

.period-btn {
    padding: 5px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ml-text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--ml-transition);
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.3px;
}

.period-btn:hover {
    color: var(--ml-text);
    background: rgba(0, 0, 0, 0.03);
}

.period-btn.active {
    background: var(--ml-gradient-primary);
    color: #fff;
}

/* ============================================================================
   EMPTY STATE
   ============================================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--ml-text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 13px;
    font-weight: 500;
}

/* ============================================================================
   CODE INLINE
   ============================================================================ */
code {
    background: var(--ml-card-bg-alt);
    padding: 3px 8px;
    border-radius: var(--ml-radius-xs);
    font-size: 12px;
    border: 1px solid var(--ml-border-light);
    color: var(--ml-primary);
    font-weight: 500;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ============================================================================
   SCROLLBAR
   ============================================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ml-border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--ml-text-muted); }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 1200px) {
    .receipts-layout {
        grid-template-columns: 1fr;
    }
    .preview-panel {
        position: static;
        max-height: 500px;
    }
    .charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 20px 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .topbar {
        padding: 0 16px;
    }

    .hamburger {
        display: flex !important;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 22px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 16px 18px;
    }

    .setup-card {
        padding: 28px 24px;
        width: calc(100vw - 32px);
    }
}

.hamburger {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--ml-radius-sm);
    border: 1px solid var(--ml-border);
    background: transparent;
    font-size: 16px;
    transition: var(--ml-transition);
    color: var(--ml-text-muted);
}

.hamburger:hover {
    border-color: var(--ml-primary);
    color: var(--ml-primary);
}

/* ============================================================================
   SIDEBAR mobile overlay
   ============================================================================ */
@media (max-width: 768px) {
    .sidebar.open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }
}

/* ============================================================================
   FOOTER TEXT
   ============================================================================ */
.footer-text {
    text-align: center;
    color: var(--ml-text-muted);
    font-size: 11px;
    font-weight: 500;
    margin-top: 32px;
    letter-spacing: 0.3px;
}
