:root {
    --accent: #2d6cdf;
    --accent-dark: #1f54b5;
    --line: #e3e6ec;
    --bg: #f4f5f7;
    --fg: #1f2430;
    --muted: #6b7280;
    --green: #1b8a3a;
    --red: #b3261e;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--fg);
}

a { color: var(--accent); }

/* --- Topbar --- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 700; }
.topbar nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.topbar .who { color: var(--muted); font-size: 0.9rem; }
.topbar .logout { font-weight: 600; }

/* --- Layout --- */
.wrap {
    max-width: 60rem;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}
h1 { font-size: 1.5rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.muted { color: var(--muted); line-height: 1.5; }

/* --- Cards --- */
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.25rem;
}

.login-card {
    max-width: 26rem;
    margin: 8vh auto 0;
}

/* --- Forms --- */
.stack { display: flex; flex-direction: column; }
.stack label { font-weight: 600; margin: 0.85rem 0 0.35rem; }
.stack input, .inline-form input, .inline-form select, select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #c7ccd6;
    border-radius: 8px;
    font-size: 1rem;
    background: #fff;
}
.stack input:focus, .inline-form input:focus { outline: none; border-color: var(--accent); }

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}
.inline-form input, .inline-form select { width: auto; flex: 1 1 auto; min-width: 12rem; }
.chk { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; margin: 0.35rem 0; }
.chk input { width: auto; }

.btn-primary {
    margin-top: 1.25rem;
    padding: 0.65rem 1.25rem;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    align-self: flex-start;
}
.inline-form .btn-primary { margin-top: 0; }
.btn-primary:hover { background: var(--accent-dark); }

.btn-link {
    border: 0;
    background: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    text-decoration: underline;
}
.btn-link.danger, .danger { color: var(--red); }

/* --- Flash --- */
.flash {
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    margin-bottom: 1rem;
    border: 1px solid;
}
.flash-success { background: #e8f5e9; border-color: var(--green); color: var(--green); }
.flash-error { background: #fdecea; border-color: var(--red); color: var(--red); }

/* --- Report grid (Auswahl) --- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1rem;
}
.report-tile {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 6rem;
    text-decoration: none;
    color: var(--fg);
}
.report-tile:hover { border-color: var(--accent); }
.report-title { font-weight: 600; font-size: 1.05rem; }
.report-go { color: var(--accent); font-size: 0.9rem; margin-top: 0.75rem; }

/* --- Tables --- */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.92rem;
}
.table th, .table td {
    text-align: left;
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--line);
}
.table th { background: #fafbfc; font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.actions form { display: inline; }
.row-actions { margin-top: 1rem; }

.stats { display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.stat {
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    padding: 1rem 1.5rem; min-width: 8rem;
}
.stat-num { display: block; font-size: 1.8rem; font-weight: 700; }
.stat-lbl { color: var(--muted); font-size: 0.85rem; }
.admin-nav { margin: 0 0 1.25rem; }

/* --- Report-Viewer (Vollbild-iFrame) --- */
body.viewer { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.report-frame { flex: 1 1 auto; width: 100%; border: 0; }
