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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f6fa;
    color: #2d3436;
    font-size: 14px;
}

.navbar {
    background: #2c3e50;
    color: white;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 56px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand {
    font-size: 18px;
    font-weight: 700;
    margin-right: 40px;
    color: #ecf0f1;
}

.nav-links { display: flex; gap: 4px; }

.nav-links a {
    color: #bdc3c7;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-links a:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-links a.active { background: #3498db; color: white; }

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

h1 { font-size: 24px; margin-bottom: 20px; color: #2c3e50; }
h2 { font-size: 18px; margin-bottom: 16px; color: #34495e; }

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

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

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

.stat-value { font-size: 32px; font-weight: 700; color: #2c3e50; }
.stat-label { font-size: 13px; color: #7f8c8d; margin-top: 4px; }
.stat-card.warning .stat-value { color: #e67e22; }
.stat-card.success .stat-value { color: #27ae60; }

/* Tables */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th {
    background: #34495e;
    color: white;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid #ecf0f1;
}

tr:hover td { background: #f8f9fa; }

.text-right { text-align: right; }
.text-center { text-align: center; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-warning { background: #ffeaa7; color: #d35400; }
.badge-success { background: #a8e6cf; color: #006100; }
.badge-danger { background: #fab1a0; color: #c0392b; }
.badge-info { background: #74b9ff; color: #0652DD; }
.badge-ai { background: #dfe6e9; color: #6c5ce7; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary { background: #3498db; color: white; }
.btn-primary:hover { background: #2980b9; }
.btn-success { background: #27ae60; color: white; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-secondary { background: #95a5a6; color: white; }
.btn-secondary:hover { background: #7f8c8d; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 4px; color: #34495e; }

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-control:focus { outline: none; border-color: #3498db; box-shadow: 0 0 0 3px rgba(52,152,219,0.1); }

select.form-control { appearance: auto; }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* Upload area */
.upload-area {
    border: 2px dashed #bdc3c7;
    border-radius: 12px;
    padding: 60px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafbfc;
}

.upload-area:hover, .upload-area.dragover {
    border-color: #3498db;
    background: #ebf5fb;
}

.upload-area h3 { margin-bottom: 8px; color: #7f8c8d; }
.upload-area p { color: #95a5a6; font-size: 13px; }

/* Filters bar */
.filters {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.filters .form-group { margin-bottom: 0; min-width: 160px; }
.filters label { font-size: 12px; }

/* Alerts */
.alert {
    padding: 12px 20px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-weight: 500;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* AI analysis panel */
.ai-panel {
    background: #f8f9ff;
    border: 1px solid #ddd;
    border-left: 4px solid #6c5ce7;
    border-radius: 4px;
    padding: 12px;
    margin-top: 8px;
    font-size: 12px;
}

.ai-panel .ai-header { font-weight: 700; color: #6c5ce7; margin-bottom: 4px; }
.ai-panel .ai-reasons { color: #636e72; }

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .navbar { flex-direction: column; height: auto; padding: 12px; }
    .nav-links { flex-wrap: wrap; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
}
