:root {
    --bg: #fafaf9;
    --fg: #1c1917;
    --muted: #78716c;
    --accent: #0d9488;
    --accent-fg: #ffffff;
    --critical: #b91c1c;
    --high: #c2410c;
    --medium: #a16207;
    --low: #4d7c0f;
    --card: #ffffff;
    --border: #e7e5e4;
    --hover: #f5f5f4;
}

[data-theme="dark"] {
    --bg: #0c0a09;
    --fg: #f5f5f4;
    --muted: #a8a29e;
    --accent: #2dd4bf;
    --card: #1c1917;
    --border: #292524;
    --hover: #1c1917;
}

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

html, body {
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100%;
}

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

/* Header / Nav */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
    position: sticky;
    top: 0;
    z-index: 10;
}
.app-header-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--fg);
}
.app-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
    overflow-x: auto;
}
.app-nav a {
    color: var(--muted);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 0.9rem;
}
.app-nav a:hover { background: var(--hover); color: var(--fg); text-decoration: none; }
.app-nav a.active { background: var(--accent); color: var(--accent-fg); }

main {
    max-width: 1024px;
    margin: 0 auto;
    padding: 1.25rem 1rem 4rem;
}

/* Flash messages */
.flash { padding: 0.75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.error { background: #fee2e2; color: #991b1b; }
.flash.ok { background: #d1fae5; color: #065f46; }

/* Karten */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.card h2 { font-size: 1.15rem; margin-bottom: 0.75rem; }
.card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.card-meta { color: var(--muted); font-size: 0.875rem; }

/* Coach-Inbox-Items */
.coach-item {
    display: grid;
    grid-template-columns: 6px 1fr;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.coach-item:last-child { border-bottom: 0; }
.coach-item .pill { border-radius: 3px; }
.coach-item .pill.critical { background: var(--critical); }
.coach-item .pill.high { background: var(--high); }
.coach-item .pill.medium { background: var(--medium); }
.coach-item .pill.low { background: var(--low); }
.coach-item .titel { font-weight: 600; }
.coach-item .begruendung { color: var(--muted); font-size: 0.9rem; margin-top: 0.25rem; }
.coach-item .frist { color: var(--high); font-size: 0.85rem; margin-top: 0.25rem; }
.coach-item .actions { margin-top: 0.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.coach-item .handoff {
    background: #fef3c7;
    color: #78350f;
    border-left: 3px solid var(--medium);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    background: var(--accent);
    color: var(--accent-fg);
    border: 0;
    border-radius: 8px;
    padding: 0.6rem 1.1rem;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--fg); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--hover); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }

/* Forms */
form .row { display: grid; gap: 0.75rem; margin-bottom: 0.75rem; }
@media (min-width: 600px) { form .row.cols2 { grid-template-columns: 1fr 1fr; } }
form label { font-weight: 500; font-size: 0.9rem; color: var(--muted); display: block; margin-bottom: 0.25rem; }
form input[type=text], form input[type=number], form input[type=date], form input[type=password], form select, form textarea {
    width: 100%;
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    font-family: inherit;
}
form input:focus, form select:focus, form textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
form .section-heading { font-size: 1.05rem; font-weight: 600; margin: 1.5rem 0 0.5rem; padding-bottom: 0.25rem; border-bottom: 1px solid var(--border); }

/* Tabellen */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; }
tr:hover td { background: var(--hover); }
.status-pill { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 12px; font-size: 0.8rem; }
.status-pill.ungeprueft { background: #f3f4f6; color: #4b5563; }
.status-pill.beantragt, .status-pill.eingereicht { background: #fef3c7; color: #92400e; }
.status-pill.bewilligt, .status-pill.bescheid-da, .status-pill.abgegeben { background: #d1fae5; color: #065f46; }
.status-pill.abgelehnt, .status-pill.verjaehrt { background: #fee2e2; color: #991b1b; }
.status-pill.pflicht { background: #fde68a; color: #78350f; }

/* Steuer-Jahr-Karten Grid */
.jahre-grid { display: grid; gap: 0.75rem; grid-template-columns: 1fr; }
@media (min-width: 600px) { .jahre-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .jahre-grid { grid-template-columns: 1fr 1fr 1fr; } }
.jahr-card .jahr-jahr { font-size: 1.4rem; font-weight: 700; }
.jahr-card.kritisch { border-color: var(--critical); border-width: 2px; }
