:root {
    font-family:Arial,sans-serif;
    color:#202932;
    background:#fff;
    font-size:16px;
    line-height:1.5;
    --line:#d8dfe4;
    --ink:#202932;
    --muted:#4b5863;
    --action:#254f60;
    color-scheme:light
}

* {
    box-sizing:border-box
}

body {
    margin:0
}

::selection {
    background:#c7e3ed;
    color:#14242b
}

a {
    color:#214f64;
    text-underline-offset:3px
}

a:hover {
    text-decoration-thickness:2px
}

button,input,select,textarea {
    font:inherit
}

button,.button {
    min-height:44px;
    border:1px solid var(--action);
    background:var(--action);
    color:#fff;
    padding:10px 18px;
    border-radius:4px;
    cursor:pointer;
    text-decoration:none;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:8px
}

button:hover,.button:hover {
    background:#163d4d;
    color:#fff
}

.secondary {
    background:#fff;
    color:var(--action)
}

.danger {
    background:#fff;
    color:#942d26;
    border-color:#b46a65
}

.danger:hover {
    background:#7c2923;
    color:#fff
}

button:disabled {
    opacity:.5;
    cursor:default
}

:focus-visible {
    outline:3px solid #26748c;
    outline-offset:3px
}

input,select,textarea {
    display:block;
    max-width:100%;
    width:100%;
    min-height:44px;
    padding:9px 11px;
    border:1px solid #7d8b94;
    border-radius:3px;
    background:#fff;
    color:var(--ink);
    caret-color:var(--action)
}

input[type=color] {
    padding:3px;
    width:90px
}

input[type=checkbox] {
    display:inline-block;
    min-height:20px;
    width:20px;
    vertical-align:middle;
    margin-right:8px
}

label {
    display:block;
    font-weight:600;
    margin-bottom:6px
}

h1,h2,h3,p {
    margin-top:0
}

h1 {
    font-size:clamp(1.6rem,3vw,2.25rem);
    line-height:1.2;
    margin-bottom:12px;
    overflow-wrap:anywhere
}

h2 {
    font-size:1.25rem;
    line-height:1.3;
    margin-bottom:20px
}

h3 {
    font-size:1.05rem
}

p {
    max-width:72ch
}

.muted,.hint {
    color:var(--muted)
}

.hint {
    font-size:.875rem;
    margin-top:5px
}

.public-calendar {
    padding:20px 12px 12px;
    max-width:1800px;
    margin:auto
}

.calendar-heading {
    margin-bottom:24px
}

.legend {
    display:flex;
    gap:8px 14px;
    flex-wrap:wrap;
    list-style:none;
    padding:0;
    margin:24px 0 0;
    font-size:.75rem
}

.legend li {
    display:flex;
    align-items:center;
    gap:5px
}

.swatch {
    width:18px;
    height:18px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:1px solid #727c84;
    border-radius:3px;
    font-size:9px;
    font-weight:700;
    color:#111
}

.frei {
    background:var(--frei)
}

.belegt {
    background:var(--belegt)
}

.reserviert {
    background:var(--reserviert)
}

.geschlossen {
    background:var(--geschlossen)
}

.changeover {
    background:linear-gradient(135deg,var(--frei) 50%,var(--belegt) 50%)
}

.months {
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr));
    gap:28px 20px
}

.month {
    min-width:0;
    border-top:1px solid var(--line);
    padding-top:12px
}

.month h2 {
    font-size:1rem;
    margin:0 0 10px
}

.month table {
    width:100%;
    table-layout:fixed;
    border-collapse:separate;
    border-spacing:3px;
    font-variant-numeric:tabular-nums
}

.month th {
    font-size:.75rem;
    color:var(--muted);
    font-weight:400;
    height:22px
}

.month td {
    padding:0;
    height:37px;
    vertical-align:top;
    text-align:center
}

.day {
    height:37px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    font-size:.85rem;
    line-height:1.1;
    border-radius:3px
}

.occupied {
    background:linear-gradient(135deg,var(--am) 50%,var(--pm) 50%);
    color:#111;
    text-shadow:0 0 2px #fff,0 0 2px #fff
}

.day small {
    height:9px;
    font-size:8px;
    line-height:9px;
    font-weight:700;
    margin-top:2px
}

.past .day {
    color:#64717b;
    background:#f1f3f4
}

.today .day {
    outline:2px solid #254f60;
    outline-offset:0;
    font-weight:700
}

.calendar-note {
    color:var(--muted);
    font-size:.8rem;
    margin:12px 0 0
}

.admin {
    background:#f5f7f8
}

.topbar {
    background:#fff;
    border-bottom:1px solid var(--line);
    padding:16px max(20px,calc((100% - 1160px)/2));
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:16px
}

.topbar strong {
    font-size:1.1rem
}

.topbar form {
    margin:0
}

.workspace {
    max-width:1200px;
    margin:32px auto;
    padding:0 20px 40px
}

.admin-grid {
    display:grid;
    grid-template-columns:220px minmax(0,1fr);
    gap:32px
}

.sidebar nav {
    display:grid;
    gap:6px;
    margin:12px 0 24px
}

.sidebar a {
    display:block;
    overflow-wrap:anywhere;
    padding:10px 12px;
    border-radius:3px
}

.sidebar a[aria-current=page] {
    background:#e1ebef;
    color:#173d4d;
    font-weight:bold
}

.panel {
    background:#fff;
    border:1px solid var(--line);
    border-radius:5px;
    padding:24px;
    margin-bottom:24px
}

.panel>h2 {
    margin-bottom:20px
}

.form-grid {
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr));
    gap:18px;
    margin-bottom:20px
}

.actions {
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:12px
}

.notice {
    padding:14px 18px;
    border:1px solid #8fac9c;
    background:#edf5ef;
    margin-bottom:24px;
    border-radius:4px
}

.error {
    border-color:#c58d87;
    background:#fff2ef;
    color:#7d2921
}

.auth {
    max-width:560px;
    margin:8vh auto;
    padding:0 20px
}

.auth .panel {
    padding:32px
}

.auth label {
    margin-top:20px
}

.auth button {
    margin-top:24px;
    width:100%
}

.entry-list {
    list-style:none;
    padding:0;
    margin:0
}

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

.entry p {
    margin:0
}

.entry small {
    color:var(--muted)
}

.entry form {
    margin:0
}

.entry .actions {
    gap:8px
}

.entry .button,.entry button {
    padding:8px 12px;
    font-size:.875rem
}

.color-fields {
    display:flex;
    gap:20px;
    flex-wrap:wrap;
    margin-bottom:24px
}

.color-fields label {
    font-size:.875rem
}

.embed {
    font-family:Arial,sans-serif;
    font-size:.85rem;
    min-height:140px;
    overflow-wrap:anywhere;
    margin-bottom:12px
}

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

.section-heading h1 {
    margin-bottom:0
}

.version {
    font-size:.75rem;
    color:var(--muted);
    margin-top:24px
}

details>summary {
    cursor:pointer;
    font-weight:600;
    padding:10px 0
}

details[open]>summary {
    margin-bottom:12px
}

.backup-form {
    margin-top:24px
}

.auth code {
    overflow-wrap:anywhere
}

iframe {
    max-width:100%
}

.import-source {
    padding:20px 0;
    border-top:1px solid var(--line)
}

.import-source h3 {
    margin-bottom:6px
}

.conflict {
    color:#8a2921
}

code {
    overflow-wrap:anywhere
}

summary:hover {
    color:var(--action)
}

.month .week-number {
    width:24px;
    font-size:.65rem;
    color:#52616c;
    vertical-align:middle;
    border-right:1px solid var(--line)
}

.week-number abbr {
    text-decoration:none
}

.months {
    grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr))
}

@media(min-width:1700px) {
    .months {
        grid-template-columns:repeat(6,minmax(0,1fr))
    }
}

@media(max-width:700px) {
    .admin-grid {
        grid-template-columns:1fr;
        gap:16px
    }
    .sidebar nav {
        display:flex;
        flex-wrap:wrap;
        margin:8px 0
    }
    .workspace {
        margin-top:20px;
        padding-inline:12px
    }
    .panel {
        padding:18px
    }
    .entry {
        align-items:flex-start;
        flex-direction:column
    }
    .section-heading {
        flex-direction:column
    }
    .topbar {
        padding:12px
    }
    .auth .panel {
        padding:24px
    }
    .public-calendar {
        padding-inline:8px
    }
}

@media(prefers-reduced-motion:no-preference) {
    button,.button,a {
        transition:background-color .15s ease-out
    }
}

/* Compact public calendar: about 80 percent of the previous month dimensions. */
.public-calendar {
    max-width: 1440px;
    padding: 16px 10px 10px;
}

.public-calendar h1 {
    font-size: clamp(1.28rem, 2.4vw, 1.8rem);
}

.calendar-heading {
    margin-bottom: 19px;
}

.legend {
    margin: 12px 0 0;
}

.months {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 22px 16px;
}

.month {
    padding-top: 10px;
}

.month h2 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}

.month table {
    border-spacing: 2px;
}

.month th {
    font-size: 12px;
    font-weight: 700;
    color: #202932;
    height: 18px;
}

.month td, .day {
    height: 30px;
}

.day {
    font-size: 14px;
    font-weight: 600;
    color: #202932;
}

.occupied {
    color: #111111;
    text-shadow: none;
}

.day small {
    font-size: 9px;
    height: 9px;
    line-height: 9px;
    margin-top: 1px;
}

.month .week-number {
    width: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #4b5863;
}

.auth-link {
    margin-top: 24px;
    margin-bottom: 0;
}

.auth .password-visibility {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-weight: 400;
    cursor: pointer;
}

.auth .password-visibility[hidden] {
    display: none;
}

.password-visibility input[type=checkbox] {
    flex: 0 0 20px;
    margin: 0;
}

.term-filter {
    margin-bottom: 20px;
}

.term-month {
    margin-top: 24px;
    margin-bottom: 8px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

@media (min-width: 1400px) {
    .months {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}


/* Halbtagesfarben je Tag (ersetzt Inline-Styles, damit die CSP ohne 'unsafe-inline' auskommt). */
.am-frei { --am:var(--frei) }
.am-belegt { --am:var(--belegt) }
.am-reserviert { --am:var(--reserviert) }
.am-geschlossen { --am:var(--geschlossen) }
.pm-frei { --pm:var(--frei) }
.pm-belegt { --pm:var(--belegt) }
.pm-reserviert { --pm:var(--reserviert) }
.pm-geschlossen { --pm:var(--geschlossen) }
