:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e2e5ea;
    --text: #1c2128;
    --muted: #6b7280;
    --primary: #2f5fed;
    --primary-dark: #1f45c4;
    --success: #16a34a;
    --success-bg: #e9f9ee;
    --danger: #dc2626;
    --danger-bg: #fdecec;
    --warning: #d97706;
    --warning-bg: #fef3e0;
    --local: #7c3aed;
    --local-bg: #f2ebfe;
    --cloud: #0891b2;
    --cloud-bg: #e6f7fa;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

h1, h2, h3 { margin: 0 0 4px; font-weight: 600; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
a { color: var(--primary); }

/* ── Auth-Seite ─────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #eef1fb 0%, var(--bg) 60%);
}
.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 12px;
    background: var(--primary); color: #fff; font-weight: 700; font-size: 18px;
    margin-bottom: 12px;
}
.auth-logo.small { width: 28px; height: 28px; font-size: 12px; border-radius: 8px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }

/* ── Formulare ─────────────────────────────────────────── */
input, select, textarea {
    font-family: inherit; font-size: 14px; padding: 9px 11px;
    border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d4fb; border-color: var(--primary); }
label { font-size: 13px; }
textarea { resize: vertical; font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12.5px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
    font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none;
    background: #fff; color: var(--text); border-color: var(--border);
}
.btn:hover { filter: brightness(0.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger-bg); border-color: #f5c2c2; color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f5c2c2; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bfe8cc; }

/* ── App-Shell ─────────────────────────────────────────── */
.topbar {
    display: flex; align-items: center; gap: 24px;
    padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.topbar-brand { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; }

.tabs { display: flex; gap: 4px; flex: 1; }
.tab-btn {
    padding: 7px 14px; border: none; background: transparent; border-radius: 8px;
    font-size: 13.5px; font-weight: 500; color: var(--muted); cursor: pointer;
}
.tab-btn:hover { background: var(--bg); color: var(--text); }
.tab-btn.active { background: var(--primary); color: #fff; }

.content { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.panel-head { margin-bottom: 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.category-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.category-tabs button {
    padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
    background: #fff; font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--muted);
}
.category-tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── Karten & Tabellen ─────────────────────────────────── */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.badge {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
}
.badge-local { background: var(--local-bg); color: var(--local); }
.badge-cloud { background: var(--cloud-bg); color: var(--cloud); }
.badge-ok { background: var(--success-bg); color: var(--success); }
.badge-err { background: var(--danger-bg); color: var(--danger); }
.badge-neutral { background: var(--bg); color: var(--muted); }

.score { font-weight: 700; }
.score-high { color: var(--success); }
.score-mid { color: var(--warning); }
.score-low { color: var(--danger); }

/* ── CSS-Balkendiagramm ────────────────────────────────── */
.bar-row { display: grid; grid-template-columns: 160px 1fr 48px; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-label { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { background: var(--bg); border-radius: 6px; height: 16px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--primary); transition: width .3s ease; }
.bar-value { font-size: 12px; font-weight: 600; text-align: right; }

.progress-track { background: var(--bg); border-radius: 999px; height: 10px; overflow: hidden; margin: 10px 0; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width .2s ease; }

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,18,25,.45);
    display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-box {
    background: #fff; border-radius: var(--radius); max-width: 640px; width: 100%;
    max-height: 85vh; overflow-y: auto; padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.modal-box h2 { margin-bottom: 14px; }
.modal-close { float: right; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }
pre.code-block {
    background: #0f1219; color: #d7dae0; padding: 12px; border-radius: 8px; overflow-x: auto;
    font-size: 12px; white-space: pre-wrap; word-break: break-word;
}

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-grid label { display: flex; flex-direction: column; gap: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.checkbox-row input { width: auto; }

.model-pick-list, .test-pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; padding: 4px; border: 1px solid var(--border); border-radius: 8px; }
.model-pick-item, .test-pick-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; }
.model-pick-item:hover, .test-pick-item:hover { background: var(--bg); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14161b; --surface: #1c1f26; --border: #2a2e37; --text: #e6e8ec; --muted: #9aa1ac;
        --success-bg: #12331f; --danger-bg: #3a1616; --warning-bg: #3a2a0d;
        --local-bg: #241a3d; --cloud-bg: #0d2c33;
    }
    input, select, textarea, .category-tabs button, .btn { background: #21242c; color: var(--text); }
    .btn-primary { background: var(--primary); color: #fff; }
    .modal-box { background: #1c1f26; }
    pre.code-block { background: #05060a; }
}
