:root {
    --bg: #f7f5ef;
    --surface: #ffffff;
    --ink: #22241f;
    --muted: #666a60;
    --line: #ddd7ca;
    --accent: #336b54;
    --accent-dark: #214836;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.55;
}

body.theme-wald {
    --bg: #eef4ea;
    --surface: #fbfff8;
    --ink: #1d2a20;
    --muted: #5a6659;
    --line: #c9d8c2;
    --accent: #2f6f3e;
    --accent-dark: #214f2d;
}

body.theme-fest {
    --bg: #fff7e8;
    --surface: #ffffff;
    --ink: #2c241b;
    --muted: #74634d;
    --line: #ead7b7;
    --accent: #b6532c;
    --accent-dark: #7f351f;
}

body.theme-nacht {
    --bg: #161914;
    --surface: #222820;
    --ink: #edf2e6;
    --muted: #b4bea9;
    --line: #394135;
    --accent: #85b56b;
    --accent-dark: #c7e6b5;
}

body.theme-dunklerwald {
    --bg: #101811;
    --surface: #19251b;
    --ink: #edf6ea;
    --muted: #aebda9;
    --line: #35533c;
    --accent: #7caf5e;
    --accent-dark: #d2f0bf;

    background:
        radial-gradient(circle at top left,
            rgba(124, 175, 94, .22),
            transparent 34rem),
        linear-gradient(180deg,
            #0c130d 0%,
            #172219 100%);

    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
}

body.theme-gruenerbaum {
    --bg: #f1f8ec;
    --surface: #ffffff;
    --ink: #20321f;
    --muted: #5e6f5a;
    --line: #bad1b1;
    --accent: #3f8b43;
    --accent-dark: #245d29;
    background:
        url("/assets/img/logo.png") center 8rem / min(70vw, 720px) no-repeat fixed,
        linear-gradient(180deg, #f7fbf2 0%, #e8f4df 100%);
}

body.theme-gruenerbaum::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(247, 251, 242, .88);
}

body.theme-verrueckt {
    --bg: #fffbe8;
    --surface: #ffffff;
    --ink: #211a32;
    --muted: #665f79;
    --line: #2fcbdf;
    --accent: #e83f8f;
    --accent-dark: #7b2cff;
    background:
        linear-gradient(90deg, rgba(47, 203, 223, .18) 0 12px, transparent 12px 28px),
        linear-gradient(135deg, #fffbe8 0%, #eafcff 48%, #fff0f7 100%);
}

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

.site-header,
.site-footer,
main {
    width: min(1040px, calc(100% - 32px));
    margin: 0 auto;
}

.page-admin .site-header,
.page-admin .site-footer,
.page-admin main {
    width: min(1600px, 92vw);
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
}

.brand-mark {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    font-weight: 700;
    overflow: hidden;
    transition: width .2s ease, height .2s ease;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.page-home:not(.scrolled) .brand-mark {
    width: 64px;
    height: 64px;
}

nav,
.admin-nav,
.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.menu-toggle {
    display: none;
}

nav a,
.admin-nav a {
    padding: 7px 9px;
    border-radius: 6px;
    color: var(--ink);
    text-decoration: none;
}

nav a.active,
nav a:hover,
.admin-nav a.active,
.admin-nav a:hover {
    background: #909894;
}

.simple-hero,
.page-intro,
.content-band,
.article {
    padding: 34px 0;
}

.simple-hero {
    border-bottom: 1px solid var(--line);
}

.home-hero {
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
    gap: 30px;
    align-items: center;
}

.home-logo {
    width: min(260px, 70vw);
    aspect-ratio: 1;
    object-fit: contain;
}

.club-name {
    color: var(--accent-dark);
    font-weight: 800;
    margin: 0 0 8px;
}

.welcome-text {
    margin-top: 14px;
}

.simple-hero h1,
.page-intro h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: 1.05;
}

.simple-hero p,
.page-intro p,
.lead {
    max-width: 680px;
    margin: 0;
    color: var(--muted);
    font-size: 1.1rem;
}

h1,
h2,
h3 {
    line-height: 1.18;
    margin: 0 0 10px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-heading h2 {
    margin: 0;
}

.compact-list,
.report-grid,
.three-months,
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}

.compact-list article,
.report-card,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 18px;
}

.compact-list article:nth-child(3n + 1),
.report-grid .report-card:nth-child(3n + 1) {
    background: color-mix(in srgb, var(--surface) 82%, #ffe1a8);
}

.compact-list article:nth-child(3n + 2),
.report-grid .report-card:nth-child(3n + 2) {
    background: color-mix(in srgb, var(--surface) 82%, #cfe3d9);
}

.compact-list article:nth-child(3n),
.report-grid .report-card:nth-child(3n) {
    background: color-mix(in srgb, var(--surface) 82%, #f4c9d8);
}

.log-overview {
    display: grid;
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
}

.log-table th,
.log-table td {
    border-bottom: 1px solid var(--line);
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

.log-table th {
    color: var(--muted);
    font-size: .92rem;
}

.status-ok,
.status-fail {
    font-weight: 800;
}

.status-ok {
    color: var(--accent-dark);
}

.status-fail {
    color: #b8574d;
}

.report-card {
    display: block;
    color: var(--ink);
    text-decoration: none;
    overflow: hidden;
}

.report-card:hover {
    border-color: var(--accent);
}

.report-card-image {
    display: block;
    width: calc(100% + 36px);
    height: 150px;
    margin: -18px -18px 14px;
    object-fit: cover;
}

time,
.meta {
    color: var(--muted);
    font-size: .92rem;
}

.list {
    display: grid;
    padding-bottom: 34px;
}

.item {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 20px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
}

.article {
    max-width: 760px;
}

.article time {
    display: block;
    margin: 18px 0 6px;
}

.markdown {
    margin-top: 24px;
}

.markdown h2,
.markdown h3 {
    margin-top: 20px;
    font-size: 1.2rem;
}

.markdown ul {
    padding-left: 20px;
}

form {
    display: grid;
    gap: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.narrow {
    max-width: 560px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-weight: 700;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 12px;
}

legend {
    color: var(--muted);
    font-weight: 800;
    padding: 0 6px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check input {
    width: auto;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
    color: var(--ink);
    background: var(--surface);
    font: inherit;
}

textarea {
    resize: vertical;
}

.button,
button {
    border: 0;
    border-radius: 7px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
}

button:hover,
.button:hover {
    background: var(--accent-dark);
}

.editor-actions button {
    min-height: 34px;
    padding: 6px 10px;
    background: #909894;
    color: var(--ink);
}

.calendar-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 18px;
}

.calendar-panel {
    border-bottom: 1px solid var(--line);
    padding-bottom: 24px;
}

.calendar-panel summary {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    padding: 9px 12px;
}

.calendar-subscribe {
    max-width: 720px;
    margin-top: 16px;
}

.calendar-subscribe summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    padding: 9px 12px;
}

.info-dot {
    display: inline-grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: .8rem;
    font-weight: 800;
}

.calendar-controls a {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    padding: 8px 10px;
    text-decoration: none;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.pagination a {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    min-width: 34px;
    padding: 6px 10px;
    text-align: center;
    text-decoration: none;
}

.pagination a.active,
.pagination a:hover {
    background: var(--accent);
    color: #fff;
}

.calendar-controls a.active,
.filter-note {
    background: #119d5c;
    border-color: #a6c7b8;
    border-radius: 6px;
    color: var(--accent-dark);
    padding: 8px 10px;
}

.month {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 14px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.calendar-grid strong,
.calendar-day,
.calendar-empty {
    min-height: 42px;
    border-radius: 5px;
    padding: 5px;
}

.calendar-grid strong {
    color: var(--muted);
    font-size: .82rem;
}

.calendar-day {
    border: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden;
    color: var(--ink);
    text-decoration: none;
}

.calendar-day b,
.calendar-day small {
    display: block;
}

.calendar-day small {
    color: var(--accent-dark);
    font-size: .72rem;
    line-height: 1.2;
}

.calendar-day.has-event {
    border-color: #9fc2b1;
    background: #e4f1eb;
}

.calendar-day.has-event.recurring-only {
    border-color: color-mix(in srgb, var(--line) 62%, var(--accent));
    background: color-mix(in srgb, var(--surface) 78%, var(--muted));
}

.calendar-day.today {
    box-shadow: inset 0 0 0 2px var(--accent-dark);
}

.calendar-day.today b {
    display: inline-grid;
    min-width: 22px;
    height: 22px;
    place-items: center;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
}

.calendar-day.has-event:hover,
.calendar-day.selected {
    border-color: var(--accent);
    background: #cfe3d9;
    color: var(--ink);
}

.admin-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.admin-list-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.admin-list-item strong {
    display: block;
}

.equal-actions,
.image-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.secondary {
    border: 1px solid var(--line);
    background: #e8eadf;
    color: var(--ink);
}

.danger {
    background: #b8574d;
}

.small {
    min-height: 30px;
    padding: 5px 8px;
    font-size: .88rem;
}

.icon-button {
    min-width: 32px;
    padding: 4px 7px;
}

.inline-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.confirm-dialog {
    width: min(440px, calc(100vw - 32px));
    border: 0;
    border-radius: 10px;
    padding: 0;
    background: transparent;
    color: var(--ink);
}

.confirm-dialog::backdrop {
    background: rgba(0, 0, 0, .45);
}

.confirm-dialog .panel {
    margin: 0;
}

.image-grid img {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    border-radius: 6px;
}

.image-card {
    display: grid;
    gap: 10px;
}

.image-card.is-new {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px #cfe3d9;
}

code {
    display: block;
    overflow-wrap: anywhere;
    border-radius: 6px;
    background: #909894;
    padding: 8px;
}

.blog-image {
    margin: 22px 0;
}

.blog-image img {
    display: block;
    width: 100%;
    border-radius: 8px;
}

.blog-image-klein {
    max-width: 280px;
}

.blog-image-mittel {
    max-width: 520px;
}

.blog-image-gross {
    max-width: 100%;
}

.blog-image figcaption {
    color: var(--muted);
    font-size: .9rem;
    margin-top: 6px;
}

.theme-verrueckt .site-header {
    border-bottom: 3px solid var(--accent);
}

.theme-verrueckt .brand-mark {
    background: #fff;
    box-shadow: 0 0 0 3px #ffd23f;
}

.theme-verrueckt .panel,
.theme-verrueckt .report-card,
.theme-verrueckt .compact-list article,
.theme-verrueckt .month {
    border-width: 2px;
    box-shadow: 5px 5px 0 #ffd23f;
}

.theme-verrueckt .button,
.theme-verrueckt button {
    background: var(--accent);
    color: #fff;
}

details {
    display: grid;
    gap: 12px;
}

summary {
    cursor: pointer;
    font-weight: 800;
    margin: 10px 0;
}

.theme-fest .compact-list article:nth-child(3n + 1),
.theme-fest .report-grid .report-card:nth-child(3n + 1) {
    background: #fff0cf;
}

.theme-fest .compact-list article:nth-child(3n + 2),
.theme-fest .report-grid .report-card:nth-child(3n + 2) {
    background: #ffe3d6;
}

.theme-fest .compact-list article:nth-child(3n),
.theme-fest .report-grid .report-card:nth-child(3n) {
    background: #edf4d2;
}

.theme-wald .compact-list article:nth-child(3n + 1),
.theme-wald .report-grid .report-card:nth-child(3n + 1) {
    background: #dcebd7;
}

.theme-wald .compact-list article:nth-child(3n + 2),
.theme-wald .report-grid .report-card:nth-child(3n + 2) {
    background: #eff7dc;
}

.theme-wald .compact-list article:nth-child(3n),
.theme-wald .report-grid .report-card:nth-child(3n) {
    background: #d9eee9;
}

.theme-nacht .compact-list article:nth-child(3n + 1),
.theme-nacht .report-grid .report-card:nth-child(3n + 1) {
    background: #263624;
}

.theme-nacht .compact-list article:nth-child(3n + 2),
.theme-nacht .report-grid .report-card:nth-child(3n + 2) {
    background: #2e2f44;
}

.theme-nacht .compact-list article:nth-child(3n),
.theme-nacht .report-grid .report-card:nth-child(3n) {
    background: #3a2a31;
}

.theme-dunklerwald .compact-list article:nth-child(3n + 1),
.theme-dunklerwald .report-grid .report-card:nth-child(3n + 1) {
    background: #203923;
}

.theme-dunklerwald .compact-list article:nth-child(3n + 2),
.theme-dunklerwald .report-grid .report-card:nth-child(3n + 2) {
    background: #263927;
}

.theme-dunklerwald .compact-list article:nth-child(3n),
.theme-dunklerwald .report-grid .report-card:nth-child(3n) {
    background: #1d3027;
}

.theme-dunklerwald .secondary,
.theme-dunklerwald .editor-actions button,
.theme-dunklerwald .calendar-controls a,
.theme-dunklerwald .calendar-panel summary,
.theme-dunklerwald .calendar-subscribe summary {
    border-color: #5f815f;
    background: #233627;
    color: #edf6ea;
}

.theme-dunklerwald .secondary:hover,
.theme-dunklerwald .editor-actions button:hover,
.theme-dunklerwald .calendar-controls a:hover {
    background: #2f4b34;
    color: #ffffff;
}

.theme-dunklerwald .calendar-day {
    border-color: #35533c;
    background: #142017;
    color: #edf6ea;
}

.theme-dunklerwald .calendar-day.has-event {
    border-color: #7caf5e;
    background: #244c2c;
}

.theme-dunklerwald .calendar-day.has-event.recurring-only {
    border-color: #4d654f;
    background: #253329;
}

.theme-dunklerwald .calendar-day.today {
    box-shadow: inset 0 0 0 2px #d2f0bf;
}

.theme-dunklerwald .calendar-day.today b {
    background: #d2f0bf;
    color: #101811;
}

.theme-dunklerwald .calendar-day.has-event small {
    color: #d2f0bf;
}

.theme-dunklerwald .calendar-day.has-event:hover,
.theme-dunklerwald .calendar-day.selected {
    background: #7caf5e;
    color: #101811;
}

.theme-dunklerwald .calendar-day.selected small {
    color: #101811;
}

.theme-gruenerbaum .calendar-day.has-event.recurring-only {
    border-color: #b9c9b3;
    background: #eef3e9;
}

.theme-gruenerbaum .calendar-day.today {
    box-shadow: inset 0 0 0 2px #245d29;
}

.theme-fest .calendar-day.has-event.recurring-only {
    border-color: #d6c6ac;
    background: #f6eddb;
}

.theme-fest .calendar-day.today {
    box-shadow: inset 0 0 0 2px #7f351f;
}

.theme-nacht .calendar-day.has-event.recurring-only {
    border-color: #4b5548;
    background: #2a3027;
}

.theme-nacht .calendar-day.today {
    box-shadow: inset 0 0 0 2px #c7e6b5;
}

.theme-verrueckt .calendar-day.has-event.recurring-only {
    border-color: #bbb2cc;
    background: #f4eff9;
}

.theme-verrueckt .calendar-day.today {
    box-shadow: inset 0 0 0 2px #7b2cff;
}

.theme-dunklerwald .filter-note,
.theme-dunklerwald .calendar-controls a.active {
    background: #7caf5e;
    color: #101811;
    border-color: #d2f0bf;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    background: #e4f1eb;
    color: var(--accent-dark);
    padding: 2px 7px;
    font-size: .75rem;
    vertical-align: middle;
}

.theme-dunklerwald .badge {
    background: #7caf5e;
    color: #101811;
}

.theme-gruenerbaum .compact-list article:nth-child(3n + 1),
.theme-gruenerbaum .report-grid .report-card:nth-child(3n + 1) {
    background: rgba(227, 243, 214, .94);
}

.theme-gruenerbaum .compact-list article:nth-child(3n + 2),
.theme-gruenerbaum .report-grid .report-card:nth-child(3n + 2) {
    background: rgba(213, 238, 223, .94);
}

.theme-gruenerbaum .compact-list article:nth-child(3n),
.theme-gruenerbaum .report-grid .report-card:nth-child(3n) {
    background: rgba(246, 240, 202, .94);
}

.theme-verrueckt .compact-list article:nth-child(3n + 1),
.theme-verrueckt .report-grid .report-card:nth-child(3n + 1) {
    background: #fff36b;
}

.theme-verrueckt .compact-list article:nth-child(3n + 2),
.theme-verrueckt .report-grid .report-card:nth-child(3n + 2) {
    background: #8df3ff;
}

.theme-verrueckt .compact-list article:nth-child(3n),
.theme-verrueckt .report-grid .report-card:nth-child(3n) {
    background: #ffb4dc;
}

.text-right {
    text-align: right;
}

.admin-workspace {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.blog-workspace {
    grid-template-columns: minmax(260px, 330px) minmax(520px, 1fr) minmax(280px, 380px);
}

.admin-sidebar,
.admin-tools {
    position: sticky;
    top: 96px;
}

.admin-main {
    min-width: 0;
}

.compact-heading {
    align-items: center;
    margin-bottom: 10px;
}

.empty-state {
    min-height: 260px;
}

.sortable-item {
    cursor: grab;
}

.sortable-item.is-dragging {
    opacity: .55;
}

.drag-handle {
    color: var(--muted);
    font-weight: 800;
}

.order-form {
    display: none;
}

.copy-source {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
}

.admin-separator {
    color: var(--muted);
    font-weight: 800;
    border-top: 2px solid var(--line);
    padding-top: 12px;
    margin-top: 10px;
}

.admin-list-link,
.message-list-link {
    display: block;
    flex: 1;
    min-width: 0;
    color: var(--ink);
    text-decoration: none;
}

.admin-list-link:hover strong,
.message-list-link:hover strong {
    text-decoration: underline;
}

.message-list-link.active {
    background: #191881;
    border-radius: 6px;
    padding: 8px;
}

.message-list-link span,
.admin-list-link span {
    display: block;
}

.message-detail {
    max-width: 900px;
}

.notice {
    margin: 16px auto 0;
    border: 1px solid #a6c7b8;
    border-radius: 8px;
    background: #909894;
    padding: 12px 14px;
}

.notice.error {
    border-color: #d6a099;
    background: #fae8e5;
}

.error-text {
    color: #9b3028;
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
    padding: 24px 0 36px;
}

.site-footer nav {
    gap: 12px;
}

@media (max-width: 760px) {
    .site-header,
    .section-heading,
    .item,
    .inline-action,
    .home-hero,
    .log-overview,
    .admin-workspace,
    .blog-workspace {
        align-items: flex-start;
        flex-direction: column;
        grid-template-columns: 1fr;
    }

    .admin-sidebar,
    .admin-tools {
        position: static;
        width: 100%;
    }

    .site-header {
        display: flex;
    }

    .menu-toggle {
        display: inline-flex;
        align-self: flex-end;
    }

    #main-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        border-top: 1px solid var(--line);
        padding-top: 10px;
    }

    #main-menu.open {
        display: flex;
    }

    .simple-hero h1,
    .page-intro h1 {
        font-size: 2rem;
    }

    .home-logo {
        width: min(190px, 70vw);
    }

    .three-months {
        grid-template-columns: 1fr;
    }

    .calendar-grid {
        gap: 3px;
    }

    .calendar-day {
        min-height: 38px;
        padding: 4px;
    }

    .calendar-day small {
        font-size: .66rem;
    }

    .page-home:not(.scrolled) .brand-mark {
        width: 46px;
        height: 46px;
    }
}
