@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    /* Analytics Dashboard Palette */
    --primary: #1E40AF;
    --primary-light: #3B82F6;
    --primary-dark: #1E3A8A;
    --primary-subtle: #DBEAFE;
    --accent: #D97706;
    --accent-light: #FEF3C7;
    --success: #059669;
    --success-light: #D1FAE5;
    --warning: #D97706;
    --warning-light: #FEF3C7;
    --danger: #DC2626;
    --danger-light: #FEE2E2;
    --info: #0891B2;
    --info-light: #CFFAFE;

    /* Neutrals */
    --bg: #F8FAFC;
    --bg-alt: #F1F5F9;
    --card: #FFFFFF;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --text: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;

    /* Swiss Grid System */
    --radius: 6px;
    --radius-lg: 10px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);

    /* Transitions */
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ══════════════════════════════════════ */
/*  SIDEBAR NAV                          */
/* ══════════════════════════════════════ */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--primary-dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    overflow-y: auto;
}

.sidebar-logo {
    padding: var(--spacing-lg);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo span {
    color: rgba(255,255,255,0.5);
    font-weight: 400;
}

.sidebar-nav {
    padding: var(--spacing-md) 0;
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px var(--spacing-lg);
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    color: white;
    background: rgba(255,255,255,0.07);
}
.sidebar-nav a.active {
    color: white;
    background: rgba(255,255,255,0.1);
    border-left-color: var(--primary-light);
}

.sidebar-nav .nav-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.sidebar-section {
    padding: var(--spacing-md) var(--spacing-lg) var(--spacing-xs);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
}

.sidebar-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
}
.sidebar-footer .user-name {
    color: rgba(255,255,255,0.8);
    font-weight: 500;
}
.sidebar-footer .user-role {
    color: rgba(255,255,255,0.4);
    font-size: 11px;
}
.sidebar-footer a {
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    font-size: 12px;
    margin-top: 8px;
    display: inline-block;
}
.sidebar-footer a:hover { color: white; }

/* Main Content */
.main {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
}

/* Top Bar */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0 var(--spacing-xl);
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40;
}
.topbar h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.topbar-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--spacing-xl);
}

/* Page Header */
.page-header {
    margin-bottom: var(--spacing-lg);
}
.page-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}
.page-header p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
}

/* ══════════════════════════════════════ */
/*  CARDS                                */
/* ══════════════════════════════════════ */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

/* ══════════════════════════════════════ */
/*  METRIC CARDS (Kacheln)               */
/* ══════════════════════════════════════ */
.kacheln {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}
.kachel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg) var(--spacing-md);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}
.kachel:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.kachel-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}
.kachel-zahl {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    line-height: 1;
}
.kachel-trend {
    font-size: 12px;
    margin-top: var(--spacing-xs);
}
.kachel-trend.up { color: var(--success); }
.kachel-trend.down { color: var(--danger); }

.kachel--primary { border-left: 3px solid var(--primary); }
.kachel--primary .kachel-zahl { color: var(--primary); }
.kachel--success { border-left: 3px solid var(--success); }
.kachel--success .kachel-zahl { color: var(--success); }
.kachel--warning { border-left: 3px solid var(--warning); }
.kachel--warning .kachel-zahl { color: var(--warning); }
.kachel--danger { border-left: 3px solid var(--danger); }
.kachel--danger .kachel-zahl { color: var(--danger); }
.kachel--info { border-left: 3px solid var(--info); }
.kachel--info .kachel-zahl { color: var(--info); }

/* ══════════════════════════════════════ */
/*  TABLES                               */
/* ══════════════════════════════════════ */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
    background: transparent;
    white-space: nowrap;
}
td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}
tr { transition: background var(--transition); }
tr:hover td { background: var(--bg-alt); }
tr:last-child td { border-bottom: none; }

td.mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
}

/* Clickable rows */
tr[onclick], tr[style*="cursor"] {
    cursor: pointer;
}

/* ══════════════════════════════════════ */
/*  BUTTONS                              */
/* ══════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    line-height: 1.4;
    font-family: inherit;
}
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 2px rgba(30, 64, 175, 0.2);
}
.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.3);
}
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #B91C1C; }
.btn-outline {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: var(--bg-alt);
    border-color: var(--text-muted);
}
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 6px 10px;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-alt); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; font-weight: 600; }

/* ══════════════════════════════════════ */
/*  BADGES                               */
/* ══════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.badge-roh { background: #F1F5F9; color: #475569; }
.badge-roh::before { background: #94A3B8; }
.badge-validiert { background: var(--primary-subtle); color: var(--primary); }
.badge-validiert::before { background: var(--primary-light); }
.badge-funnel_gesendet { background: #EDE9FE; color: #7C3AED; }
.badge-funnel_gesendet::before { background: #8B5CF6; }
.badge-angereichert { background: #E0E7FF; color: #4338CA; }
.badge-angereichert::before { background: #6366F1; }
.badge-gescored { background: var(--accent-light); color: #92400E; }
.badge-gescored::before { background: var(--accent); }
.badge-verifiziert { background: var(--success-light); color: #065F46; }
.badge-verifiziert::before { background: var(--success); }
.badge-exportiert { background: var(--info-light); color: #155E75; }
.badge-exportiert::before { background: var(--info); }
.badge-abgelehnt { background: var(--danger-light); color: #991B1B; }
.badge-abgelehnt::before { background: var(--danger); }

/* ══════════════════════════════════════ */
/*  FORMS                                */
/* ══════════════════════════════════════ */
input, select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background: var(--card);
    transition: all var(--transition);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
input::placeholder { color: var(--text-muted); }

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.form-group { margin-bottom: var(--spacing-md); }

/* ══════════════════════════════════════ */
/*  LOGIN                                */
/* ══════════════════════════════════════ */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}
.login-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-2xl);
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}
.login-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    text-align: center;
    color: var(--text);
}
.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

/* ══════════════════════════════════════ */
/*  UPLOAD                               */
/* ══════════════════════════════════════ */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-2xl) var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg);
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary-light);
    background: rgba(59, 130, 246, 0.04);
}
.upload-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-subtle);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: var(--spacing-md);
}
.upload-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}
.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* ══════════════════════════════════════ */
/*  DETAIL VIEW                          */
/* ══════════════════════════════════════ */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}
.detail-item {
    padding: var(--spacing-sm) 0;
}
.detail-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

/* Validation indicators */
.valid { color: var(--success); }
.invalid { color: var(--danger); }
.valid::before { content: '\2713 '; }
.invalid::before { content: '\2717 '; }

/* ══════════════════════════════════════ */
/*  SCORE                                */
/* ══════════════════════════════════════ */
.score-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 auto var(--spacing-sm);
}
.score-a { color: var(--success); background: var(--success-light); border: 3px solid var(--success); }
.score-b { color: var(--primary); background: var(--primary-subtle); border: 3px solid var(--primary-light); }
.score-c { color: var(--warning); background: var(--warning-light); border: 3px solid var(--warning); }
.score-d { color: var(--danger); background: var(--danger-light); border: 3px solid var(--danger); }

.score-display {
    text-align: center;
}
.score-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* Score bars */
.score-bar-wrap {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}
.score-bar-label {
    font-size: 12px;
    color: var(--text-muted);
    width: 100px;
    flex-shrink: 0;
}
.score-bar {
    flex: 1;
    height: 6px;
    background: var(--bg-alt);
    border-radius: 3px;
    overflow: hidden;
}
.score-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--primary-light);
    transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}
.score-bar-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    width: 32px;
    text-align: right;
}

/* ══════════════════════════════════════ */
/*  FILTER BAR                           */
/* ══════════════════════════════════════ */
.filter-bar {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
    align-items: end;
    padding: var(--spacing-md);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }

/* ══════════════════════════════════════ */
/*  QA FORM                              */
/* ══════════════════════════════════════ */
.qa-option {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}
.qa-option label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}
.qa-option label:hover {
    border-color: var(--primary-light);
    background: rgba(59, 130, 246, 0.04);
}
.qa-option input[type="radio"] {
    width: auto;
    margin: 0;
    accent-color: var(--primary);
}
.qa-option input[type="radio"]:checked + span,
.qa-option label:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-subtle);
    color: var(--primary);
}

/* ══════════════════════════════════════ */
/*  CHART (Scoring Bars)                 */
/* ══════════════════════════════════════ */
.chart-bars {
    display: flex;
    gap: var(--spacing-sm);
    align-items: end;
    height: 160px;
    padding: var(--spacing-md) 0;
}
.chart-bar {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
}
.chart-bar-fill {
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--primary) 100%);
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: height 600ms cubic-bezier(0.4, 0, 0.2, 1);
}
.chart-bar-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
    font-weight: 500;
}
.chart-bar-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-top: 2px;
}

/* ══════════════════════════════════════ */
/*  MODAL / OVERLAY                      */
/* ══════════════════════════════════════ */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    overflow-y: auto;
    padding: var(--spacing-xl);
    display: none;
}
.overlay.active { display: block; }
.modal {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-xl);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}
.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

/* ══════════════════════════════════════ */
/*  EMPTY STATE                          */
/* ══════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
}
.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--bg-alt);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: var(--spacing-md);
}
.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}
.empty-state p {
    font-size: 13px;
    color: var(--text-muted);
}

/* ══════════════════════════════════════ */
/*  SECTION DIVIDER                      */
/* ══════════════════════════════════════ */
.section {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}
.section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

/* ══════════════════════════════════════ */
/*  RESPONSIVE                           */
/* ══════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
    .kacheln { grid-template-columns: repeat(2, 1fr); }
    .detail-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; }
    .container { padding: var(--spacing-md); }
}
