:root {
    color-scheme: light;
    --bg: #eef3f5;
    --panel: #ffffff;
    --panel-soft: #f6fafc;
    --text: #1b252d;
    --muted: #5f6d77;
    --line: #d4dde3;
    --brand: #9f1f2d;
    --brand-dark: #711722;
    --brand-deep: #1b252d;
    --brand-soft: #f3e7e9;
    --gold: #b89a55;
    --danger: #8f1d2b;
    --warn: #7b5d18;
    --ok: #256b44;
    --info: #2f5f82;
    --shadow: 0 10px 24px rgba(31, 37, 43, .08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, sans-serif;
    background:
        linear-gradient(90deg, rgba(242, 247, 249, .86), rgba(242, 247, 249, .7)),
        linear-gradient(180deg, rgba(255, 255, 255, .68), rgba(232, 239, 243, .78)),
        url("/assets/hero-firefighter-training-original-zoomout.png") center center / cover fixed no-repeat,
        var(--bg);
    color: var(--text);
    line-height: 1.45;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.top {
    display: flex;
    gap: 18px;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: rgba(27, 37, 45, .92);
    border-bottom: 4px solid var(--brand);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .22);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 5;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 78px;
    color: #ffffff;
    font-weight: 800;
    letter-spacing: 0;
}
.brand::before {
    content: "";
    width: 12px;
    align-self: stretch;
    background: linear-gradient(180deg, var(--brand), var(--brand-dark));
}
.brand:hover { text-decoration: none; }
.brand-logo {
    max-height: 46px;
    max-width: 180px;
    object-fit: contain;
    background: #ffffff;
    border-radius: 4px;
    padding: 4px;
}
nav { display: flex; flex-wrap: wrap; gap: 2px; }
nav a {
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    min-height: 78px;
    padding: 0 15px;
    border-left: 1px solid rgba(255, 255, 255, .1);
    font-weight: 650;
}
nav a:hover {
    background: rgba(159, 31, 45, .5);
    color: #ffffff;
    text-decoration: none;
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 34px 24px 48px; }
.app-public .wrap {
    display: grid;
    min-height: calc(100vh - 84px);
    align-content: start;
    grid-template-columns: minmax(280px, 520px);
}
.app-login .wrap {
    min-height: calc(100vh - 84px - 44px);
    padding-bottom: 20px;
}
.app-public {
    background-color: var(--bg);
}
.app-public h1 {
    max-width: 520px;
    background: linear-gradient(135deg, rgba(27, 37, 45, .88), rgba(99, 34, 40, .66));
}
h1 {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(27, 37, 45, .84), rgba(99, 34, 40, .58));
    border-left: 8px solid var(--brand);
    border-radius: 10px;
    box-shadow: 0 18px 34px rgba(23, 32, 38, .22);
    backdrop-filter: blur(10px);
    font-size: clamp(1.65rem, 2.6vw, 2.45rem);
    margin: 0 0 24px;
    padding: 34px 30px;
}
h2 { color: var(--text); font-size: 1.3rem; margin-top: 30px; }
.panel h2,
form.panel h2,
.task-dashboard h2,
.task-card h2 {
    color: var(--text);
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.task-dashboard {
    background:
        linear-gradient(135deg, rgba(255,255,255,.98), rgba(246,250,252,.95));
    border: 1px solid rgba(212, 221, 227, .86);
    border-left: 6px solid var(--brand);
    border-radius: 10px;
    box-shadow: 0 18px 38px rgba(23, 32, 38, .14);
    margin: 0 0 24px;
    padding: 18px;
}
.task-summary {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 14px;
}
.task-summary h2 { margin: 0 0 2px; }
.task-summary p { margin: 0; }
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.task-card {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px;
}
.task-card h2 {
    font-size: 1rem;
    margin: 8px 0 10px;
}
.task-card.is-open { border-top: 4px solid var(--brand); }
.task-card.is-done { border-top: 4px solid var(--ok); }
.task-count {
    color: var(--brand);
    font-size: 2.2rem;
    font-weight: 850;
    line-height: 1;
    margin-right: 8px;
}
.flame-icon {
    display: inline-block;
    width: 34px;
    height: 44px;
    background: radial-gradient(circle at 50% 72%, #d8b86a 0 25%, #b96b3a 26% 56%, var(--brand) 57% 100%);
    border-radius: 60% 60% 65% 65%;
    transform: rotate(45deg);
    box-shadow: 0 0 18px rgba(159, 31, 45, .28);
    animation: flamePulse 1.3s ease-in-out infinite;
}
.task-dashboard.all-done {
    border-left-color: var(--ok);
}
.task-dashboard.all-done .flame-icon {
    background: #cfd7dc;
    box-shadow: none;
    animation: extinguish .9s ease-out forwards;
}
@keyframes flamePulse {
    0%, 100% { transform: rotate(45deg) scale(1); }
    50% { transform: rotate(45deg) scale(1.08); }
}
@keyframes extinguish {
    0% { transform: rotate(45deg) scale(1); opacity: 1; }
    55% { transform: rotate(45deg) scale(.82); opacity: .55; }
    100% { transform: rotate(45deg) scale(.68); opacity: .35; }
}
.activity-panel {
    margin-bottom: 24px;
}
.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.activity-list li {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 4px;
    padding: 10px 0;
}
.activity-list li:last-child {
    border-bottom: 0;
}
.activity-list time {
    color: var(--muted);
    font-size: .92rem;
}
.activity-more {
    margin: 14px 0 0;
}
.panel, form.panel {
    background: rgba(255, 255, 255, .97);
    border: 1px solid rgba(215, 224, 229, .9);
    border-top: 4px solid var(--brand);
    border-radius: 10px;
    box-shadow: 0 16px 36px rgba(23, 32, 38, .13);
    padding: 20px;
    color: var(--text);
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.muted { color: var(--muted); }
.flash {
    padding: 11px 13px;
    border-radius: 6px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--brand);
    background: #fff;
}
.flash.ok { border-color: #a9ccb8; border-left-color: var(--ok); background: #eff7f2; }
.flash.err { border-color: #dca4aa; border-left-color: var(--danger); background: #fbf0f1; }
.impersonation-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #d8c28d;
    border-left: 6px solid var(--gold);
    border-radius: 8px;
    background: #fbf6e9;
    color: var(--text);
    box-shadow: 0 10px 24px rgba(23, 32, 38, .08);
}
.impersonation-banner span {
    color: var(--muted);
}
.impersonation-banner form {
    margin: 0;
}
label { display: block; font-weight: 650; margin-top: 12px; }
input, select, textarea, button {
    font: inherit;
}
input, select, textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #c6d1d8;
    border-radius: 8px;
    background: #fff;
}
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    accent-color: var(--brand);
    vertical-align: middle;
}
label:has(> input[type="checkbox"]),
label:has(> input[type="radio"]) {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    line-height: 1.3;
}
input:focus, select:focus, textarea:focus {
    outline: 3px solid rgba(159, 31, 45, .16);
    border-color: var(--brand);
}
textarea { min-height: 90px; resize: vertical; }
button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--brand);
    background: linear-gradient(180deg, #b52a38, var(--brand));
    color: white;
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 3px 0 var(--brand-dark), 0 10px 20px rgba(159, 31, 45, .16);
}
.button:hover, button:hover { background: var(--brand-dark); text-decoration: none; }
.button.secondary, button.secondary {
    background: #fff;
    color: var(--brand);
    box-shadow: none;
}
.button.secondary:hover, button.secondary:hover { background: var(--brand-soft); }
.button.danger, button.danger { background: var(--danger); border-color: var(--danger); }
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid #cbd6dd;
    border-radius: 8px;
    box-shadow: 0 14px 30px rgba(23, 32, 38, .1);
    overflow: hidden;
    color: var(--text);
}
th, td {
    padding: 12px 13px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
th:last-child,
td:last-child { border-right: 0; }
tr:last-child td { border-bottom: 0; }
th {
    background: linear-gradient(180deg, #33414b, var(--brand-deep));
    color: #ffffff;
    font-weight: 750;
}
th:first-child { border-top-left-radius: 7px; }
th:last-child { border-top-right-radius: 7px; }
tr:last-child td:first-child { border-bottom-left-radius: 7px; }
tr:last-child td:last-child { border-bottom-right-radius: 7px; }
tr:nth-child(even) td { background: #f7fafc; }
tr:hover td { background: #f2f5f7; }
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: #eef0f2;
    color: var(--brand-deep);
    font-size: .88rem;
    font-weight: 750;
}
.badge.warn { background: #f6eed8; color: var(--warn); }
.badge.danger { background: #f7e5e7; color: var(--danger); }
.badge.ok { background: #e4f1e9; color: var(--ok); }
.badge.info { background: #e5eef5; color: var(--info); }
.login {
    max-width: 520px;
    margin: 8px 0 48px;
    border-top-color: var(--brand);
}
.login::before {
    content: "Feuerwehr Lehrgangsverwaltung";
    display: block;
    color: var(--brand);
    font-size: .92rem;
    font-weight: 800;
    margin-bottom: 10px;
}
.signature-pad {
    width: 100%;
    height: 180px;
    border: 2px dashed #9da6ad;
    border-radius: 6px;
    background: white;
    touch-action: none;
}
.attendance-list {
    display: grid;
    gap: 16px;
}
.attendance-card {
    margin: 0;
}
.attendance-card.is-locked {
    border-top-color: var(--ok);
    background: #f7fbf8;
}
.attendance-card h2 {
    margin: 0 0 4px;
}
.attendance-card .signature-pad {
    min-height: 210px;
}
.app-footer {
    color: var(--muted);
    font-size: .86rem;
    min-height: 44px;
    padding: 0 24px 12px;
    text-align: center;
}
.app-footer p {
    margin: 0 auto;
    max-width: 1200px;
    padding-top: 10px;
    border-top: 1px solid rgba(215, 224, 229, .86);
}
.app-footer a {
    color: var(--brand);
    font-weight: 700;
}
@media (max-width: 700px) {
    .top { align-items: stretch; flex-direction: column; padding: 0 16px 12px; }
    .brand { min-height: 64px; }
    nav a {
        min-height: 40px;
        padding: 0 10px;
        border: 1px solid rgba(255, 255, 255, .14);
        border-radius: 4px;
    }
    .wrap { padding: 16px; }
    .app-public .wrap { min-height: auto; }
    h1 { font-size: 1.55rem; padding: 22px 18px; }
    table { display: block; overflow-x: auto; }
}
