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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, #7c3aed, #ec4899);
    color: white;
    padding: 1.5rem 2rem;
}

header .brand h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

header .brand p {
    opacity: 0.85;
    font-size: 0.95rem;
    font-weight: 300;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.alert-banner {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #92400e;
    display: none;
}

.alert-banner.visible {
    display: block;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-align: center;
}

.stat-card .emoji {
    font-size: 1.75rem;
    margin-bottom: 0.4rem;
}

.stat-card .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #7c3aed;
}

.stat-card .label {
    font-size: 0.8rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    padding: 0.6rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-box:focus {
    border-color: #7c3aed;
}

.filter-select {
    padding: 0.6rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    outline: none;
    cursor: pointer;
}

.chart-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 1.5rem;
    margin-bottom: 2rem;
    height: 300px;
}

.section-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: #1e293b;
}

.table-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow-x: auto;
    margin-bottom: 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead {
    background: #f1f5f9;
}

th {
    padding: 0.75rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

td {
    padding: 0.7rem 0.75rem;
    border-top: 1px solid #e2e8f0;
    white-space: nowrap;
}

tr:hover {
    background: #f8fafc;
}

.hidden {
    display: none;
}

.batch-id {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #475569;
}

.fruit-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
}

.fruit-apple { background: #fef2f2; color: #dc2626; }
.fruit-banana { background: #fefce8; color: #ca8a04; }
.fruit-orange { background: #fff7ed; color: #ea580c; }
.fruit-pear { background: #f0fdf4; color: #16a34a; }
.fruit-mango { background: #fffbeb; color: #d97706; }

.cost {
    font-weight: 600;
    color: #7c3aed;
}

.origin {
    color: #64748b;
}

.temp {
    font-weight: 500;
}

.temp-ok { color: #16a34a; }
.temp-warn { color: #d97706; }
.temp-bad { color: #dc2626; }

.quality-bar {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.quality-score {
    display: inline-block;
    width: 40px;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    position: relative;
    overflow: hidden;
}

.quality-score-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 3px;
}

.quality-high { background: #16a34a; }
.quality-mid { background: #d97706; }
.quality-low { background: #dc2626; }

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.status-passed { background: #dcfce7; color: #166534; }
.status-review { background: #fef3c7; color: #92400e; }
.status-rejected { background: #fee2e2; color: #991b1b; }

.date {
    color: #64748b;
    font-size: 0.8rem;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: #64748b;
}

.loading .spinner {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

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

footer {
    text-align: center;
    padding: 1.5rem;
    color: #94a3b8;
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .container { padding: 1rem; }
    th, td { padding: 0.5rem 0.4rem; font-size: 0.8rem; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .controls { flex-direction: column; }
    .search-box { min-width: unset; }
}
