:root {
    --color-primary: #2b6cb0;
    --color-primary-dark: #1a4971;
    --color-bg: #f4f6f8;
    --color-card: #ffffff;
    --color-text: #1a202c;
    --color-muted: #6b7280;
    --color-border: #e2e8f0;
    --color-success: #276749;
    --color-success-bg: #e6f4ea;
    --color-error: #9b2c2c;
    --color-error-bg: #fdecea;
    --color-warn-bg: #fff8e1;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header / Navigation ---------- */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-card);
    padding: 12px 24px;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
    gap: 10px;
}
.app-header-left { display: flex; align-items: center; gap: 10px; }
.header-logo { max-height: 36px; }
.app-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.app-nav a { color: var(--color-text); font-size: 14px; }
.admin-header { border-bottom: 3px solid var(--color-primary); }

.app-main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.app-footer { text-align: center; padding: 20px; color: var(--color-muted); font-size: 13px; }

/* ---------- Cards / Layout ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.card { background: var(--color-card); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 18px; }
.card h3 { margin-top: 0; display: flex; align-items: center; gap: 8px; }
.icon { flex-shrink: 0; vertical-align: middle; }
.card-header-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }

.kpi { text-align: center; }
.kpi-number { font-size: 32px; font-weight: 700; margin: 6px 0; }
.kpi-warn { border-color: #f6ad55; background: var(--color-warn-bg); }
.kpi-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 10px;
}
.kpi-icon-red { background: #fed7d7; color: #c53030; }
.kpi-icon-green { background: #c6f6d5; color: #276749; }
.kpi-icon-purple { background: #e9d8fd; color: #6b46c1; }
.kpi-icon-teal { background: #b2f5ea; color: #2c7a7b; }
.cards-2-1 { grid-template-columns: 2fr 1fr; }
@media (max-width: 800px) { .cards-2-1 { grid-template-columns: 1fr; } }

/* ---------- Forms ---------- */
label { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 600; color: var(--color-text); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=month], select, textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 9px 10px;
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: inherit;
}
textarea { font-family: inherit; }
fieldset { border: 1px solid var(--color-border); border-radius: 6px; margin-bottom: 14px; }
legend { padding: 0 6px; font-weight: 600; font-size: 13px; color: var(--color-muted); }

.checkbox-line { display: flex; align-items: center; gap: 8px; font-weight: normal; }
.checkbox-line input { width: auto; }

.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin-bottom: 0; }
.inline-form .grow { flex-grow: 1; }
.inline-action { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mini-input { width: 160px; padding: 6px 8px; font-size: 13px; }

.btn {
    display: inline-block;
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--color-primary-dark); text-decoration: none; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: #c53030; }
.btn-danger:hover { background: #9b2c2c; }

/* ---------- Tables ---------- */
.data-table, .mini-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.data-table th, .data-table td { padding: 8px 10px; border-bottom: 1px solid var(--color-border); text-align: left; font-size: 14px; }
.data-table th { background: #f8fafc; font-weight: 600; }
.mini-table td { padding: 4px 6px; font-size: 13px; border-bottom: 1px solid var(--color-border); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-pending, .badge-eingereicht, .badge-beantragt { background: #fff3cd; color: #856404; }
.badge-active, .badge-freigegeben, .badge-genehmigt { background: var(--color-success-bg); color: var(--color-success); }
.badge-disabled, .badge-abgelehnt { background: var(--color-error-bg); color: var(--color-error); }
.badge-entwurf { background: #e2e8f0; color: #4a5568; }

.positiv { color: var(--color-success); }
.negativ { color: var(--color-error); }
.konto-saldo { font-size: 16px; }

.filter-tabs { margin-bottom: 14px; }
.filter-tabs a { display: inline-block; padding: 6px 14px; margin-right: 6px; border-radius: 6px; background: #edf2f7; color: var(--color-text); font-size: 14px; }
.filter-tabs a.active { background: var(--color-primary); color: #fff; }

.hint { color: var(--color-muted); font-size: 13px; }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 14px; }
.alert-success { background: var(--color-success-bg); color: var(--color-success); }
.alert-error { background: var(--color-error-bg); color: var(--color-error); }

/* ---------- Auth pages / Installer ---------- */
.auth-body, .installer-body { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px; }
.auth-box {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 30px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}
.auth-box h1 { font-size: 20px; margin-bottom: 0; }
.auth-box h2 { font-size: 16px; color: var(--color-muted); margin-top: 4px; }
.auth-box form { text-align: left; margin-top: 16px; }
.auth-logo { max-height: 60px; margin-bottom: 10px; }
.auth-links { margin-top: 16px; font-size: 13px; }

.installer-wrap { background: var(--color-card); border-radius: var(--radius); padding: 30px; max-width: 560px; width: 100%; }
.installer-wrap form { text-align: left; }
.steps { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.steps span { padding: 4px 10px; border-radius: 999px; background: #edf2f7; font-size: 12px; color: var(--color-muted); }
.steps span.active { background: var(--color-primary); color: #fff; }
.checklist { list-style: none; padding: 0; }
.checklist li { padding: 6px 0; }
.checklist li.ok { color: var(--color-success); }
.checklist li.fail { color: var(--color-error); }

/* ---------- Legal pages ---------- */
.legal-page { max-width: 700px; margin: 40px auto; padding: 0 20px; }
.legal-content { white-space: pre-line; }

/* ---------- Sidebar-Layout (für alle Nicht-Standard-Themes) ---------- */
.shell { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: #1f2430;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; border-bottom: 1px solid rgba(255,255,255,0.12); margin-bottom: 16px; }
.brand-logo-img { max-height: 36px; max-width: 44px; border-radius: 8px; }
.brand-logo-fallback {
    width: 36px; height: 36px; border-radius: 8px; background: rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 14px; color: #fff; line-height: 1.3; }
.brand-sub { font-size: 11px; color: #9aa5b8; text-transform: uppercase; letter-spacing: 0.04em; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; margin-bottom: 6px; }
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%; background: #4b5568; color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role { font-size: 10px; color: #9aa5b8; letter-spacing: 0.05em; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px; border-radius: 8px; font-size: 13px; font-weight: 500;
    color: #cbd5e1; text-decoration: none; transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,0.14); color: #fff; }
.nav-item .icon { flex-shrink: 0; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 12px; margin-top: 12px; }
.sidebar-legal { font-size: 11px; color: #8290a3; margin-top: 10px; padding: 0 10px; }
.sidebar-legal a { color: #8290a3; }
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-area .app-main { max-width: 1200px; width: 100%; }

@media (max-width: 900px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; }
    .sidebar-brand, .sidebar-user { border: none; padding: 4px 8px; margin: 0; }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar-footer { display: flex; align-items: center; gap: 12px; border: none; margin: 0; padding: 4px 8px; }
    .sidebar-legal { margin: 0; padding: 0; }
}

/* ---------- Statistik-Diagramm ---------- */
.stat-chart { width: 100%; height: auto; margin: 10px 0; }
.stat-bar { fill: var(--color-primary); }
.stat-value { font-size: 11px; fill: var(--color-text); font-weight: 600; }
.stat-label { font-size: 11px; fill: var(--color-muted); }

/* ---------- Team-Kalender ---------- */
.kalender-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin: 12px 0;
}
.kalender-kopf { text-align: center; font-weight: 600; font-size: 13px; color: var(--color-muted); padding: 4px 0; }
.kalender-leer { background: transparent; }
.kalender-tag {
    min-height: 78px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 4px 5px;
    font-size: 12px;
    background: #fff;
}
.kalender-tag.wochenende { background: #f7fafc; }
.kalender-tag.feiertag { background: #fff8e1; border-color: #f6ad55; }
.kalender-tag.heute { border: 2px solid var(--color-primary); }
.kalender-tag-nummer { font-weight: 700; margin-bottom: 2px; }
.kalender-feiertag-name { font-size: 10px; color: #b7791f; margin-bottom: 3px; line-height: 1.2; }
.kalender-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    margin: 1px;
}
.kalender-badge-pending { opacity: 0.55; border: 2px dashed #fff; }
.kalender-legende { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 12px; align-items: center; }
.legende-eintrag { display: flex; align-items: center; gap: 5px; }
.legende-farbe { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

@media (max-width: 640px) {
    .kalender-tag { min-height: 60px; font-size: 10px; }
    .kalender-badge { width: 16px; height: 16px; font-size: 8px; }
}

/* ---------- Cookie banner ---------- */
.cookie-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #1a202c;
    color: #fff;
    z-index: 1000;
    padding: 16px;
}
.cookie-banner-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.cookie-banner a { color: #90cdf4; }
.cookie-banner p { margin: 0; font-size: 13px; flex: 1 1 400px; }

@media (max-width: 640px) {
    .app-header { flex-direction: column; align-items: flex-start; }
    .inline-form { flex-direction: column; align-items: stretch; }
}
