:root {
    --color-bg: #ffffff;
    --color-text: #1a1a1a;
    --color-accent: #1a7f37;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #121212;
        --color-text: #e6e6e6;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    line-height: 1.5;
    background: var(--color-bg);
    color: var(--color-text);
}

.site-header {
    padding: 1rem clamp(1rem, 4vw, 2rem);
    border-bottom: 2px solid var(--color-accent);
}

.site-header h1 {
    margin: 0;
    font-size: 1.25rem;
}

main {
    padding: clamp(1rem, 4vw, 2rem);
}

/* --- Public --- */

.brand {
    color: inherit;
    text-decoration: none;
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-top: 0.5rem;
}

.main-nav a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

.main-nav a:hover {
    text-decoration: underline;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1rem;
}

.card {
    display: block;
    padding: 1rem;
    border: 1px solid color-mix(in srgb, var(--color-text) 25%, transparent);
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

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

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.toolbar .filter {
    margin: 0;
    font-size: 0.85rem;
}

.segmented {
    display: inline-flex;
    border: 1px solid var(--color-accent);
    border-radius: 6px;
    overflow: hidden;
}

.segmented button {
    background: var(--color-bg);
    color: var(--color-accent);
    border-radius: 0;
    padding: 0.45rem 0.9rem;
    min-height: 44px;
}

.segmented button.active {
    background: var(--color-accent);
    color: #fff;
}

dialog.sheet {
    border: none;
    border-radius: 12px;
    padding: 1.25rem;
    max-width: 26rem;
    width: calc(100% - 2rem);
    background: var(--color-bg);
    color: var(--color-text);
}

dialog.sheet::backdrop {
    background: rgb(0 0 0 / 0.4);
}

@media (max-width: 767px) {
    dialog.sheet {
        margin: auto 0 0;
        width: 100%;
        max-width: none;
        border-radius: 12px 12px 0 0;
    }
}

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.field-row {
    display: flex;
    gap: 0.75rem;
}

.field-row label {
    flex: 1;
}

.warning-message {
    color: #bc4c00;
}

.ev-abgesagt {
    text-decoration: line-through;
    opacity: 0.6;
}

.site-footer {
    padding: 1rem clamp(1rem, 4vw, 2rem);
    border-top: 1px solid color-mix(in srgb, var(--color-text) 20%, transparent);
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
}

.site-footer a {
    color: inherit;
}

.offline-banner {
    background: #bf8700;
    color: #fff;
    text-align: center;
    padding: 0.5rem 1rem;
    font-weight: 600;
}

.bell {
    font-size: 1.2rem;
    text-decoration: none;
}

.hint {
    padding: 0.5rem 0.75rem;
    border-left: 4px solid #bf8700;
    background: color-mix(in srgb, #bf8700 12%, var(--color-bg));
}

.content-page h1 {
    margin-top: 0;
}

textarea {
    display: block;
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
    border: 1px solid var(--color-text);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text);
    font: inherit;
}

/* --- Dashboard --- */

.monitor {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-weight: 600;
}

.monitor-gruen { background: color-mix(in srgb, #1a7f37 20%, var(--color-bg)); }
.monitor-gelb { background: color-mix(in srgb, #bf8700 25%, var(--color-bg)); }
.monitor-rot { background: color-mix(in srgb, #cf222e 25%, var(--color-bg)); }
.monitor-grau { background: color-mix(in srgb, var(--color-text) 12%, var(--color-bg)); }

.bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 8rem;
    max-width: 30rem;
}

.bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: 100%;
}

.bar-fill {
    width: 100%;
    background: var(--color-accent);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
}

.bar-label {
    font-size: 0.65rem;
    opacity: 0.7;
}

.dashboard-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 1rem;
}

.filter-form,
.mass-form {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}

.filter-form label,
.mass-form label {
    margin: 0;
    font-size: 0.85rem;
}

tr.ausgeschlossen {
    opacity: 0.5;
    text-decoration: line-through;
}

pre.payload {
    background: color-mix(in srgb, var(--color-text) 8%, var(--color-bg));
    padding: 0.75rem;
    border-radius: 6px;
    overflow-x: auto;
}

/* --- Availability view --- */

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
    border: 1px solid color-mix(in srgb, var(--color-text) 30%, transparent);
}

.chip-frei { background: color-mix(in srgb, #1a7f37 15%, var(--color-bg)); }
.chip-belegt { background: color-mix(in srgb, #0969da 25%, var(--color-bg)); }
.chip-eingeschraenkt { background: color-mix(in srgb, #bf8700 30%, var(--color-bg)); }
.chip-gesperrt { background: color-mix(in srgb, #cf222e 30%, var(--color-bg)); }

.venue-block {
    margin-bottom: 2rem;
}

.venue-block .address {
    margin-top: -0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.hint {
    padding: 0.5rem 0.75rem;
    border-left: 4px solid #bf8700;
    background: color-mix(in srgb, #bf8700 12%, var(--color-bg));
}

.pitch-block {
    margin-bottom: 1rem;
}

.pitch-block h4 {
    margin: 0.5rem 0 0.25rem;
}

.day-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 3px;
}

.day-label {
    flex: 0 0 5.5rem;
    font-size: 0.8rem;
}

.timeline {
    position: relative;
    flex: 1;
    height: 2rem;
    background: color-mix(in srgb, #1a7f37 10%, var(--color-bg));
    border: 1px solid color-mix(in srgb, var(--color-text) 20%, transparent);
    border-radius: 4px;
    overflow: hidden;
}

.segment,
.segment-layer {
    position: absolute;
    top: 0;
    bottom: 0;
}

.segment {
    border: none;
    border-radius: 0;
    padding: 0 0.3rem;
    font-size: 0.7rem;
    color: var(--color-text);
    background: transparent;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-align: left;
    min-height: 0;
    font-weight: 400;
    cursor: pointer;
}

.segment-belegt {
    background: color-mix(in srgb, #0969da 35%, var(--color-bg));
}

.segment-eingeschraenkt {
    background: color-mix(in srgb, #bf8700 40%, var(--color-bg));
}

.segment-gesperrt {
    background: color-mix(in srgb, #cf222e 40%, var(--color-bg));
}

.eingeschraenkt-layer {
    background: repeating-linear-gradient(
        45deg,
        color-mix(in srgb, #bf8700 35%, transparent),
        color-mix(in srgb, #bf8700 35%, transparent) 6px,
        transparent 6px,
        transparent 12px
    );
    pointer-events: none;
}

/* --- Admin --- */

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-top: 0.5rem;
}

.admin-nav a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

.admin-nav a:hover {
    text-decoration: underline;
}

.narrow {
    max-width: 34rem;
}

form label {
    display: block;
    margin-bottom: 0.75rem;
}

form label input[type="text"],
form label input[type="password"],
form label input[type="number"],
form label select {
    display: block;
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.25rem;
    border: 1px solid var(--color-text);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text);
    font: inherit;
}

form label.checkbox input {
    width: auto;
    margin-right: 0.4rem;
}

fieldset {
    border: 1px solid var(--color-text);
    border-radius: 4px;
    margin: 0 0 0.75rem;
}

button,
.button {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    background: var(--color-accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

button.linklike {
    background: none;
    color: var(--color-accent);
    padding: 0;
    text-decoration: underline;
    font-weight: 600;
}

button.linklike.danger {
    color: #cf222e;
}

.inline-form {
    display: inline;
}

table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
}

th, td {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid color-mix(in srgb, var(--color-text) 25%, transparent);
}

.swatch {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 4px;
    vertical-align: middle;
    border: 1px solid color-mix(in srgb, var(--color-text) 30%, transparent);
}

.palette {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
}

.palette-option {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
}

.palette-label {
    font-size: 0.85rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    background: color-mix(in srgb, var(--color-accent) 15%, var(--color-bg));
    border: 1px solid var(--color-accent);
}

.error-message,
.field-error {
    color: #cf222e;
}

.field-error {
    display: block;
    font-size: 0.85rem;
    margin-top: 0.2rem;
}

.stat-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.stat-list li {
    padding: 1rem;
    border: 1px solid color-mix(in srgb, var(--color-text) 25%, transparent);
    border-radius: 8px;
}

progress {
    width: 100%;
}
