/* Modern Persian RTL Design System - Dairy Record AI */
:root {
    --font-fa: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-en: 'Outfit', sans-serif;

    /* Theme Dark (Default) */
    --bg-main: #0B0F19;
    --bg-card: rgba(18, 24, 38, 0.75);
    --bg-card-hover: rgba(28, 36, 54, 0.85);
    --bg-input: #131B2E;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(14, 165, 233, 0.35);

    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --text-dim: #64748B;

    /* Vibrant Accents */
    --primary: #0284C7;
    --primary-gradient: linear-gradient(135deg, #0284C7 0%, #2563EB 50%, #7C3AED 100%);
    --primary-hover: #0369A1;
    --accent-emerald: #10B981;
    --accent-amber: #F59E0B;
    --accent-rose: #F43F5E;
    --accent-indigo: #6366F1;
    --accent-cyan: #06B6D4;
    --accent-purple: #A855F7;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    --glow-primary: 0 0 30px rgba(2, 132, 199, 0.25);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

/* Light Theme overrides */
body.theme-light {
    --bg-main: #F8FAFC;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --bg-input: #F1F5F9;
    --border-color: rgba(0, 0, 0, 0.08);
    --border-highlight: rgba(2, 132, 199, 0.3);

    --text-main: #0F172A;
    --text-muted: #475569;
    --text-dim: #94A3B8;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: var(--font-fa);
    background-color: var(--bg-main);
    color: var(--text-main);
    direction: rtl;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ambient Glow Background */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.15;
}
.bg-glow-1 {
    width: 600px;
    height: 600px;
    background: #0284C7;
    top: -200px;
    right: -100px;
}
.bg-glow-2 {
    width: 500px;
    height: 500px;
    background: #7C3AED;
    bottom: 10%;
    left: -150px;
}
.bg-glow-3 {
    width: 400px;
    height: 400px;
    background: #10B981;
    top: 40%;
    left: 40%;
}

.app-container {
    max-width: 1380px;
    margin: 0 auto;
    padding: 24px 20px;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 28px;
}

.header-left .logo-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #FFF;
    box-shadow: var(--glow-primary);
}

.logo-text h1 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.logo-subtitle {
    font-size: 0.82rem;
    font-family: var(--font-en);
    color: var(--text-muted);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-fa);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #FFF;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-main);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-highlight);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: rgba(2, 132, 199, 0.4);
}
.btn-outline:hover {
    background: rgba(2, 132, 199, 0.1);
    border-color: var(--primary);
}

.btn-success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #FFF;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.05rem;
    border-radius: var(--radius-lg);
}

.btn-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}
.btn-icon:hover {
    color: var(--text-main);
    border-color: var(--border-highlight);
    background: var(--bg-card-hover);
}

/* Theme Toggle Icons */
body.theme-dark .theme-icon-sun { display: inline-block; }
body.theme-dark .theme-icon-moon { display: none; }
body.theme-light .theme-icon-sun { display: none; }
body.theme-light .theme-icon-moon { display: inline-block; }

/* Cards & Containers */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 32px;
    margin-bottom: 28px;
    transition: border-color 0.3s ease;
}

/* Hero Section */
.hero-card {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(2, 132, 199, 0.15);
    color: var(--primary);
    border: 1px solid rgba(2, 132, 199, 0.3);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.hero-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.35;
    margin-bottom: 10px;
}

.hero-desc {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 900px;
}

.code-tag {
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-family: var(--font-en);
    font-weight: 700;
    color: var(--accent-cyan);
    border: 1px solid var(--border-color);
}

/* Provider Selector */
.provider-selector-bar {
    background: var(--bg-input);
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.selector-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-muted);
}

.provider-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.provider-radio {
    cursor: pointer;
}
.provider-radio input {
    display: none;
}

.provider-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.provider-radio input:checked + .provider-card {
    border-color: var(--primary);
    background: rgba(2, 132, 199, 0.08);
    box-shadow: 0 0 16px rgba(2, 132, 199, 0.2);
}

.provider-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.model-count-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
body.theme-light .model-count-badge {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
}

.provider-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 800;
    width: fit-content;
}
.nvidia-badge {
    background: rgba(118, 185, 0, 0.2);
    color: #76B900;
    border: 1px solid rgba(118, 185, 0, 0.4);
}
.avalai-badge {
    background: rgba(168, 85, 247, 0.2);
    color: #A855F7;
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.provider-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}
.provider-meta {
    font-size: 0.78rem;
    color: var(--text-dim);
    font-family: var(--font-en);
    direction: ltr;
    text-align: right;
}

/* Model Selector Section */
.model-selector-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 6px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px 20px;
}
body.theme-light .model-selector-section {
    background: rgba(0, 0, 0, 0.02);
}

.model-selector-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.models-total-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    background: rgba(2, 132, 199, 0.15);
    color: var(--primary);
    border: 1px solid rgba(2, 132, 199, 0.3);
    margin-right: 8px;
}

.quick-models-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-pill {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.quick-pill:hover {
    border-color: var(--primary);
    color: var(--text-main);
    transform: translateY(-1px);
}
.quick-pill.active {
    background: rgba(2, 132, 199, 0.2);
    border-color: var(--primary);
    color: #FFF;
    box-shadow: 0 0 10px rgba(2, 132, 199, 0.25);
}
body.theme-light .quick-pill.active {
    color: var(--primary);
}

.quick-pill-tag {
    font-size: 0.7rem;
    opacity: 0.8;
}

/* Custom Model Select Dropdown */
.model-select-wrapper {
    position: relative;
    width: 100%;
}

.model-select-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}
.model-select-box:hover, .model-select-box:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
    outline: none;
}
.model-select-box.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}

.selected-model-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.selected-model-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.selected-model-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}
.selected-model-id {
    font-size: 0.78rem;
    font-family: var(--font-en);
    color: var(--text-dim);
    direction: ltr;
    text-align: right;
}
.model-select-arrow {
    color: var(--text-muted);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9rem;
}
.model-select-arrow.open {
    transform: rotate(180deg);
}

.multiplier-badge {
    font-size: 0.72rem;
    font-weight: 800;
    font-family: var(--font-en);
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    background: rgba(245, 158, 11, 0.15);
    color: #F59E0B;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.model-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #111827;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
    animation: fadeInMenu 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
}
@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
body.theme-light .model-dropdown-menu {
    background: #FFFFFF;
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.15);
}

.model-dropdown-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}
body.theme-light .model-dropdown-search {
    background: rgba(0, 0, 0, 0.03);
}
.model-dropdown-search i {
    color: var(--text-muted);
}
.model-dropdown-search input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-fa);
    font-size: 0.9rem;
    outline: none;
}
.btn-xs {
    padding: 2px 6px;
    font-size: 0.75rem;
    border-radius: 50%;
}

.model-options-list {
    max-height: 290px;
    overflow-y: auto;
    padding: 6px;
}
.model-options-list::-webkit-scrollbar {
    width: 6px;
}
.model-options-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.model-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
    gap: 12px;
}
.model-option-item:hover {
    background: rgba(2, 132, 199, 0.12);
}
.model-option-item.selected {
    background: rgba(2, 132, 199, 0.2);
    border: 1px solid rgba(2, 132, 199, 0.4);
}
body.theme-light .model-option-item:hover {
    background: rgba(2, 132, 199, 0.08);
}
body.theme-light .model-option-item.selected {
    background: rgba(2, 132, 199, 0.12);
}

.model-option-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.model-option-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.model-option-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
}
.model-option-id {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-family: var(--font-en);
    direction: ltr;
    text-align: right;
}
.model-option-tags {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.settings-provider-block {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}
body.theme-light .settings-provider-block {
    background: rgba(0, 0, 0, 0.02);
}

.settings-provider-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 14px;
}

.ai-model-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(2, 132, 199, 0.15);
    color: var(--primary);
    border: 1px solid rgba(2, 132, 199, 0.3);
}

/* Dropzone */
.dropzone {
    border: 2px dashed rgba(2, 132, 199, 0.35);
    background: rgba(2, 132, 199, 0.03);
    border-radius: var(--radius-xl);
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: rgba(2, 132, 199, 0.08);
    transform: scale(1.005);
}

.file-input-hidden {
    display: none;
}

.dropzone-icon-pulse {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: rgba(2, 132, 199, 0.12);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    transition: all 0.3s ease;
}
.dropzone:hover .dropzone-icon-pulse {
    transform: translateY(-4px);
    background: var(--primary);
    color: #FFF;
    box-shadow: var(--glow-primary);
}

.dropzone-text h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}
.dropzone-text p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.selected-file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    z-index: 2;
}

.file-excel-icon {
    font-size: 28px;
    color: var(--accent-emerald);
}

.file-details {
    display: flex;
    flex-direction: column;
    text-align: right;
}
.file-name {
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.95rem;
    direction: ltr;
}
.file-size {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-en);
}

.btn-remove {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
    border-color: rgba(244, 63, 94, 0.3);
}
.btn-remove:hover {
    background: var(--accent-rose);
    color: #FFF;
}

/* Prompt Accordion */
.prompt-accordion {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    overflow: hidden;
}

.accordion-toggle {
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-fa);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease;
}
.accordion-toggle:hover {
    color: var(--text-main);
}
.accordion-arrow {
    transition: transform 0.3s ease;
}
.accordion-toggle.open .accordion-arrow {
    transform: rotate(180deg);
}

.accordion-body {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}
.accordion-body pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.upload-actions {
    display: flex;
    justify-content: center;
}

/* Processing Section */
.processing-card {
    text-align: center;
    padding: 60px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner-orbit {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.orbit-spinner {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(2, 132, 199, 0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.processing-cow-icon {
    font-size: 32px;
    color: var(--primary);
}

.processing-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
}

.processing-desc {
    color: var(--text-muted);
    font-size: 1rem;
}

.timeline-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.timeline-step .step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.timeline-step.active {
    color: var(--primary);
}
.timeline-step.active .step-circle {
    background: rgba(2, 132, 199, 0.15);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--glow-primary);
}

.timeline-step.completed {
    color: var(--accent-emerald);
}
.timeline-step.completed .step-circle {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--accent-emerald);
    color: var(--accent-emerald);
}

/* Result Section */
.result-header-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    padding: 24px 32px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(2, 132, 199, 0.08) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

.result-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.success-check-badge {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-emerald);
    color: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.result-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-highlight);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.icon-blue { background: rgba(2, 132, 199, 0.15); color: #0284C7; }
.icon-emerald { background: rgba(16, 185, 129, 0.15); color: #10B981; }
.icon-indigo { background: rgba(99, 102, 241, 0.15); color: #6366F1; }
.icon-amber { background: rgba(245, 158, 11, 0.15); color: #F59E0B; }
.icon-purple { background: rgba(168, 85, 247, 0.15); color: #A855F7; }
.icon-cyan { background: rgba(6, 182, 212, 0.15); color: #06B6D4; }

.stat-data {
    display: flex;
    flex-direction: column;
}
.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}
.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
    font-family: var(--font-en), var(--font-fa);
}
.stat-value small {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* AI Report Card */
.ai-report-card {
    border-color: rgba(168, 85, 247, 0.3);
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.05) 0%, var(--bg-card) 100%);
}

.ai-report-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}
.ai-badge-group {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ai-provider-badge {
    background: var(--accent-purple);
    color: #FFF;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
}
.badge-status-ok {
    color: var(--accent-emerald);
    font-size: 0.85rem;
    font-weight: 700;
}

.ai-report-body {
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text-main);
    white-space: pre-wrap;
}

.typos-box {
    margin-top: 20px;
    padding: 16px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
}
.typos-box h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-amber);
    margin-bottom: 10px;
}
.typos-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.typos-list li {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* Table Card */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.table-title h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
}

.table-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: var(--radius-md);
}
.search-box input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-fa);
    font-size: 0.9rem;
    outline: none;
    width: 200px;
}

.form-select, .form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-fa);
    font-size: 0.9rem;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    outline: none;
}
.form-select:focus, .form-control:focus {
    border-color: var(--primary);
}

/* Data Table */
.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
    font-size: 0.92rem;
}

.data-table th {
    background: var(--bg-input);
    padding: 14px 16px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    user-select: none;
}
.th-sortable {
    cursor: pointer;
}
.th-sortable:hover {
    color: var(--primary);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-en), var(--font-fa);
}
.data-table tr:last-child td {
    border-bottom: none;
}
.data-table tr:hover td {
    background: rgba(2, 132, 199, 0.04);
}

.cell-body-id {
    font-weight: 800;
    color: var(--primary);
    font-size: 1rem;
}
.cell-bottle {
    font-weight: 700;
    color: var(--accent-emerald);
}

.tag-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
}
.tag-success { background: rgba(16, 185, 129, 0.15); color: #10B981; }
.tag-warning { background: rgba(245, 158, 11, 0.15); color: #F59E0B; }
.tag-danger { background: rgba(244, 63, 94, 0.15); color: #F43F5E; }

/* Pagination */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 18px;
}
.pagination-info {
    font-size: 0.88rem;
    color: var(--text-muted);
}
.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    font-family: var(--font-en), var(--font-fa);
    font-size: 0.88rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.page-btn.active {
    background: var(--primary);
    color: #FFF;
    border-color: var(--primary);
}
.page-btn:hover:not(.active) {
    background: var(--bg-card-hover);
}

/* Chart */
.chart-card {
    padding: 28px;
}
.chart-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
}
.chart-wrapper {
    height: 320px;
    position: relative;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}
.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 800;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}
.form-group label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.input-with-action {
    display: flex;
    gap: 8px;
}
.input-with-action input {
    flex: 1;
}
.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.api-test-box {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: -6px;
    margin-bottom: 10px;
}
.api-test-box.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.api-test-box.error {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 24px;
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast-icon { font-size: 18px; color: var(--primary); }
.toast-text { font-size: 0.92rem; font-weight: 600; }

/* Results Navigation Tabs */
.results-tabs-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    overflow-x: auto;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-fa);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-main);
    background: var(--bg-card);
}

.tab-btn.active {
    color: #FFF;
    background: var(--primary);
    border-color: var(--primary-hover);
    box-shadow: var(--glow-primary);
}

.tab-badge {
    background: var(--accent-rose);
    color: #FFF;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 700;
}

.tab-pane {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Discrepancy Chips Grid */
.discrepancy-chips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.chip-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.chip-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.chip-data {
    display: flex;
    flex-direction: column;
}

.chip-count {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}

.chip-title {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.chip-amber .chip-icon { background: rgba(245, 158, 11, 0.15); color: #F59E0B; }
.chip-amber .chip-count { color: #F59E0B; }

.chip-crimson .chip-icon { background: rgba(244, 63, 94, 0.15); color: #F43F5E; }
.chip-crimson .chip-count { color: #F43F5E; }

.chip-purple .chip-icon { background: rgba(168, 85, 247, 0.15); color: #A855F7; }
.chip-purple .chip-count { color: #A855F7; }

.chip-blue .chip-icon { background: rgba(2, 132, 199, 0.15); color: #0284C7; }
.chip-blue .chip-count { color: #0284C7; }

.chip-emerald .chip-icon { background: rgba(16, 185, 129, 0.15); color: #10B981; }
.chip-emerald .chip-count { color: #10B981; }

/* Audit Cards */
.audit-card {
    margin-bottom: 24px;
    padding: 0;
    overflow: hidden;
}

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

.audit-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.audit-header-title h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
}

.header-amber { background: rgba(245, 158, 11, 0.08); color: #F59E0B; }
.header-crimson { background: rgba(244, 63, 94, 0.08); color: #F43F5E; }
.header-purple { background: rgba(168, 85, 247, 0.08); color: #A855F7; }
.header-blue { background: rgba(2, 132, 199, 0.08); color: #0284C7; }
.header-emerald { background: rgba(16, 185, 129, 0.08); color: #10B981; }

.badge-pill-sub {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1px solid currentColor;
}

.audit-table th {
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.88rem;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.audit-table td {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

/* Color & typography utility helpers */
.text-amber { color: #F59E0B !important; }
.text-emerald { color: #10B981 !important; }
.text-rose { color: #F43F5E !important; }
.text-purple { color: #A855F7 !important; }
.font-bold { font-weight: 700 !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-sm { font-size: 0.85rem !important; }

.tag-amber { background: rgba(245, 158, 11, 0.15); color: #F59E0B; border: 1px solid rgba(245, 158, 11, 0.3); }
.tag-purple { background: rgba(168, 85, 247, 0.15); color: #A855F7; border: 1px solid rgba(168, 85, 247, 0.3); }

/* Utilities */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); font-size: 0.88rem; }

/* Footer */
.app-footer {
    text-align: center;
    padding: 24px 0;
    font-size: 0.85rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .hero-title {
        font-size: 1.4rem;
    }
    .timeline-steps {
        gap: 16px;
    }
    .result-header-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .results-tabs-bar {
        gap: 6px;
    }
    .tab-btn {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
}
