/*
 * IDO Plan – Oberfläche
 * Eigenes CSS ohne Build-Schritt und ohne externe Quellen (CSP: nur 'self').
 * Farben und Schriften wie bei den übrigen IDO-Anwendungen; hell/dunkel nach Systemeinstellung.
 */

@font-face { font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/fonts/archivo-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 100 700; font-display: swap;
  src: url("/fonts/ibm-plex-sans-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 100 700; font-display: swap;
  src: url("/fonts/ibm-plex-sans-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #dde4ea;
  --border-strong: #c2ccd5;
  --text: #0c151c;
  --muted: #4f5c67;
  --subtle: #76838e;
  --primary: #365692;
  --primary-strong: #2a4577;
  --primary-soft: #edf1f8;
  --primary-border: #c6d2e8;
  --on-primary: #ffffff;
  --ring: rgba(54, 86, 146, .25);
  --ok: #28763f;
  --ok-soft: #ebf5ee;
  --ok-border: #b4dac0;
  --warning: #8f5d00;
  --warning-soft: #fbf4e4;
  --warning-border: #e9d197;
  --error: #a8372e;
  --error-soft: #fbeeec;
  --error-border: #ecbdb7;
  --on-error: #ffffff;
  --today: #fff8e6;
  --weekend: #f6f8fb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(12, 21, 28, .06), 0 2px 8px rgba(12, 21, 28, .04);
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-head: "Archivo", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1520;
    --surface: #141e2b;
    --surface-2: #182434;
    --border: #253447;
    --border-strong: #34475e;
    --text: #e6edf4;
    --muted: #a7b4c2;
    --subtle: #8191a3;
    --primary: #7d9fe0;
    --primary-strong: #a3bcf0;
    --primary-soft: #1b2a42;
    --primary-border: #2f4568;
    --on-primary: #0d1520;
    --ring: rgba(125, 159, 224, .35);
    --ok: #6cc489;
    --ok-soft: #12291b;
    --ok-border: #24543a;
    --warning: #e2b75a;
    --warning-soft: #2a2312;
    --warning-border: #5b4a1f;
    --error: #f08b80;
    --error-soft: #2d1614;
    --error-border: #64302b;
    --on-error: #1d0d0b;
    --today: #262413;
    --weekend: #111b27;
    --shadow: none;
  }
}

/* --- Grundlagen ------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; font-weight: 650; }
h2 { font-size: 1.15rem; font-weight: 620; }
h3 { font-size: 1rem; font-weight: 600; }
a { color: var(--primary); }
a:hover { color: var(--primary-strong); }
code, .token { font-family: var(--font-mono); font-size: .9em; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.pre { white-space: pre-line; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; margin-right: 6px; }
.icon circle { fill: currentColor; stroke: none; }
ul.plain { list-style: none; margin: 0; padding: 0; }

/* --- Gerüst ---------------------------------------------------------------- */

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar-inner { max-width: 1400px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-family: var(--font-head); font-size: 1.15rem; }
.brand strong { color: var(--primary); }
.nav-menu { flex: 1; min-width: 0; }
.nav-main { list-style: none; display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; }
.nav-main > li > a, .dropdown > summary { display: block; padding: 7px 11px; border-radius: 7px; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
.nav-main > li > a:hover, .dropdown > summary:hover { background: var(--surface-2); color: var(--text); }
.nav-main > li > a[aria-current="page"], .dropdown > summary.is-active { background: var(--primary-soft); color: var(--primary); }
.nav-toggle-input, .nav-toggle { display: none; }

/* Klappmenüs (Verwaltung, persönliches Menü) */
.dropdown { position: relative; }
.dropdown > summary { cursor: pointer; list-style: none; user-select: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.nav-main .dropdown > summary::after { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 2px 3px 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.nav-main .dropdown[open] > summary::after { transform: rotate(-135deg); margin-bottom: 0; }
.dropdown-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 290px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(12, 21, 28, .16); padding: 6px; }
.dropdown-right .dropdown-panel { left: auto; right: 0; }
.dropdown-panel ul { list-style: none; margin: 0; padding: 0; }
.dropdown-panel a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 7px; color: var(--text); text-decoration: none; }
.dropdown-panel a span { font-weight: 550; }
.dropdown-panel a small { color: var(--muted); font-size: .8rem; }
.dropdown-panel a:hover { background: var(--surface-2); }
.dropdown-panel a[aria-current="page"] { background: var(--primary-soft); }
.dropdown-panel a[aria-current="page"] span { color: var(--primary); }
.dropdown-heading { margin: 6px 10px 2px; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--subtle); }
.dropdown-heading + ul { margin-bottom: 4px; }
.dropdown-user { display: flex; flex-direction: column; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); font-size: .9rem; }
.dropdown-user .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-logout { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.dropdown-logout button { width: 100%; text-align: left; font: inherit; font-weight: 550; padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: var(--error); cursor: pointer; }
.dropdown-logout button:hover { background: var(--error-soft); }

.topbar-user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.btn-new { min-height: 36px; padding: 6px 14px; white-space: nowrap; }
.btn-new-plus { font-size: 1.2rem; line-height: 1; margin-top: -2px; }
.user-summary { display: flex !important; align-items: center; gap: 8px; padding: 3px 4px 3px 10px !important; border-radius: 999px !important; }
.tenant-name { color: var(--muted); font-size: .9rem; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 600; font-size: .85rem; text-decoration: none; flex: none; }
.user-summary.is-active .avatar, .dropdown[open] .avatar { box-shadow: 0 0 0 3px var(--ring); }
.banner { background: var(--warning-soft); border-bottom: 1px solid var(--warning-border); padding: 8px 16px; text-align: center; font-size: .9rem; }
.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 40px; }
.page-wide { max-width: 1400px; }
.footer { text-align: center; color: var(--subtle); font-size: .85rem; padding: 0 16px 24px; }

@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; }
  .brand { order: 1; }
  .topbar-inner { gap: 8px; }
  .nav-toggle { display: inline-flex; align-items: center; gap: 8px; order: 2; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 7px; font-weight: 550; cursor: pointer; }
  .nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after { display: block; width: 16px; height: 2px; background: currentColor; border-radius: 1px; }
  .nav-toggle-icon { position: relative; }
  .nav-toggle-icon::before, .nav-toggle-icon::after { content: ""; position: absolute; left: 0; }
  .nav-toggle-icon::before { top: -5px; }
  .nav-toggle-icon::after { top: 5px; }
  .topbar-user { order: 3; }
  .nav-menu { display: none; order: 4; flex-basis: 100%; border-top: 1px solid var(--border); margin: 4px -16px 0; padding: 8px 16px; }
  .nav-toggle-input:checked ~ .nav-menu { display: block; }
  .nav-toggle-input:checked + .nav-toggle { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-border); }
  .nav-main { flex-direction: column; align-items: stretch; }
  .nav-main > li > a, .dropdown > summary { padding: 10px 12px; }
  .nav-main .dropdown-panel { position: static; box-shadow: none; border: 0; padding: 0 0 0 12px; min-width: 0; }
  .tenant-name { display: none; }
  .user-summary { padding: 0 !important; }
}
@media (max-width: 400px) {
  .btn-new { padding: 6px 11px; }
  .btn-new-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .brand span { display: none; }
}

.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { margin: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; box-shadow: var(--shadow); }
.card-danger { border-color: var(--error-border); }
.empty { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 32px; text-align: center; margin-bottom: 16px; }

/* --- Meldungen ------------------------------------------------------------- */

.alert { border: 1px solid; border-radius: var(--radius); padding: 12px 16px; margin: 0 0 16px; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert p { margin: 0 0 6px; }
.alert-success { background: var(--ok-soft); border-color: var(--ok-border); }
.alert-info { background: var(--primary-soft); border-color: var(--primary-border); }
.alert-warning { background: var(--warning-soft); border-color: var(--warning-border); }
.alert-error { background: var(--error-soft); border-color: var(--error-border); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.badge-ok { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.badge-cancelled { background: var(--error-soft); border-color: var(--error-border); color: var(--error); }

/* --- Formulare ------------------------------------------------------------- */

.form label { display: block; font-weight: 550; margin: 14px 0 5px; }
.form label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 10px 0 0; }
input[type="text"], input[type="email"], input[type="tel"], input[type="search"], input[type="url"], input[type="password"], input[type="number"], input[type="date"], input[type="time"], input[type="datetime-local"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 7px; padding: 8px 10px; min-height: 40px;
}
textarea { resize: vertical; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); }
.input-short { max-width: 140px; }
.field-error { color: var(--error); margin: 5px 0 0; font-size: .9rem; }
.help { color: var(--muted); font-size: .85rem; margin: 5px 0 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 620; font-family: var(--font-head); font-size: 1.05rem; padding: 0; margin-bottom: 4px; }
.when { margin-top: 18px; }
.when-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pair { display: flex; gap: 8px; }
.pair input[type="time"] { max-width: 130px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 180px; gap: 0 16px; align-items: end; }
.grid-2 .form-actions, .grid-3 .form-actions { grid-column: 1 / -1; }
.grid-2.nested { gap: 0 12px; }
.inline-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 12px; }
.form .inline-options label { margin: 0; }
.inline-choice { display: flex; gap: 20px; align-items: center; }
.inline-choice legend { float: left; margin-right: 12px; }
.form.narrow { max-width: 420px; }
.form.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form.inline label { margin: 0; }
.form.inline input { max-width: 280px; }
.inline-form input { min-width: 160px; }
.form-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
@media (max-width: 700px) {
  .when-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.group-title { margin: 16px 0 8px; color: var(--muted); font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; }
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.form .resource-option { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer; font-weight: 400; }
.resource-option input { margin-top: 4px; }
.resource-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.resource-text { display: flex; flex-direction: column; gap: 2px; }
.resource-name { font-weight: 600; display: inline-flex; align-items: center; }
.resource-state { font-size: .82rem; }
.resource-option.is-free .resource-state { color: var(--ok); }
.resource-option.is-busy { border-color: var(--error-border); background: var(--error-soft); }
.resource-option.is-busy .resource-state { color: var(--error); font-weight: 550; }

/* --- Schaltflächen --------------------------------------------------------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 550; padding: 8px 14px; min-height: 38px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); color: var(--on-primary); }
.btn-danger { background: var(--error); border-color: var(--error); color: var(--on-error); }
.btn-danger:hover { opacity: .9; background: var(--error); color: var(--on-error); }
.btn-block { width: 100%; margin-top: 20px; }
.btn-small { min-height: 28px; padding: 3px 10px; font-size: .85rem; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline; margin-left: 10px; }
.row-actions a + a { margin-left: 10px; }

/* --- Tabellen -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: .85rem; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table select { width: auto; min-height: 34px; padding: 4px 8px; }
.table input[type="text"] { min-height: 34px; padding: 4px 8px; }
tr.is-disabled td { color: var(--subtle); }

dl.details { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; }
dl.details.compact { grid-template-columns: 90px 1fr; margin: 8px 0; }
@media (max-width: 600px) { dl.details { grid-template-columns: 1fr; } dl.details dd { margin-bottom: 8px; } }

/* --- Belegungsplan --------------------------------------------------------- */

.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: var(--surface); margin-bottom: 8px; }
.segmented a { padding: 7px 14px; text-decoration: none; color: var(--muted); font-weight: 500; }
.segmented a + a { border-left: 1px solid var(--border-strong); }
.segmented a[aria-current="true"] { background: var(--primary); color: var(--on-primary); }
.week-nav { display: flex; gap: 6px; align-items: center; }
.week-pick input { min-height: 38px; width: auto; }

.plan-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.plan { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 980px; table-layout: fixed; }
.plan th, .plan td { border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); padding: 6px; vertical-align: top; }
.plan thead th { background: var(--surface-2); font-size: .85rem; color: var(--muted); font-weight: 600; text-align: left; position: sticky; top: 0; }
.plan .plan-resource-col { width: 200px; }
.plan th:first-child, .plan td:first-child { border-left: 0; }
.plan .plan-resource { text-align: left; font-weight: 400; background: var(--surface); position: sticky; left: 0; z-index: 1; }
.plan .plan-resource small { display: block; font-size: .78rem; }
.plan-group th { background: var(--surface-2); text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 10px; }
.plan td { height: 64px; position: relative; padding-bottom: 26px; }
.plan .is-today { background: var(--today); }
.plan .is-weekend:not(.is-today) { background: var(--weekend); }
.slot { display: block; border-radius: 6px; padding: 4px 6px; margin-bottom: 4px; background: var(--surface-2); border: 1px solid var(--border-strong); border-left: 4px solid var(--subtle); color: var(--text); text-decoration: none; font-size: .8rem; line-height: 1.3; overflow: hidden; }
.slot:hover { color: var(--text); border-color: var(--primary); }
.slot-mine { background: var(--primary-soft); border-color: var(--primary-border); border-left-color: var(--primary); }
.slot-busy { background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 6px, var(--surface-3, #ebf0f5) 6px, var(--surface-3, #ebf0f5) 12px); }
.slot-cont-before { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.slot-cont-after { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.slot-time { display: block; font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }
.slot-title { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-who { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-add { position: absolute; left: 6px; right: 6px; bottom: 4px; text-align: center; border: 1px dashed transparent; border-radius: 6px; color: var(--subtle); text-decoration: none; line-height: 18px; font-weight: 600; }
td:hover .slot-add, .slot-add:focus { border-color: var(--border-strong); color: var(--primary); }
.legend { display: flex; align-items: center; gap: 6px; font-size: .85rem; margin: 10px 0 20px; }
.legend-swatch { display: inline-block; width: 22px; height: 14px; margin: 0 2px 0 10px; padding: 0; }
.booking-list { margin: 0; padding-left: 18px; }
.booking-list li { margin: 4px 0; }

/* --- Anmeldung ------------------------------------------------------------- */

body.guest { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, var(--primary-soft), var(--bg)); }
.guest-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.guest-brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-size: 1.5rem; }
.guest-brand strong { color: var(--primary); }
.guest-claim { color: var(--muted); margin: 6px 0 18px; }
.guest-legal { margin: 22px 0 0; text-align: center; font-size: .85rem; color: var(--muted); }
.guest-legal a { color: var(--muted); }
.guest-card h1 { font-size: 1.3rem; margin-top: 8px; }
.debug { white-space: pre-wrap; font-size: .75rem; max-height: 300px; overflow: auto; background: var(--surface-2); padding: 8px; }

details.more summary { cursor: pointer; color: var(--primary); margin-top: 8px; }

@media print {
  .topbar, .footer, .toolbar, .slot-add, .btn { display: none !important; }
  .plan-scroll { overflow: visible; border: 0; }
  body { background: #fff; }
}

/* Postfächer & Zugriff */
details.mailbox > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; list-style: none; }
details.mailbox > summary::-webkit-details-marker { display: none; }
details.mailbox > summary::before { content: "▸"; color: var(--muted); width: 1em; }
details.mailbox[open] > summary::before { content: "▾"; }
details.mailbox .mailbox-name { font-weight: 600; margin-right: auto; }
details.mailbox[open] > summary { margin-bottom: 8px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; }
.form .check-grid label.check { align-items: flex-start; margin-top: 8px; }
.form .check-grid label.check input { margin-top: 3px; }

/* Aufgaben */
.tasks-layout { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: start; }
.tasks-nav { padding: 8px; }
.tasks-nav ul { list-style: none; margin: 0; padding: 0; }
.tasks-nav a { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 7px; color: var(--text); text-decoration: none; }
.tasks-nav a:hover { background: var(--surface-2); }
.tasks-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tasks-nav .count { color: var(--muted); font-size: .85rem; }
.tasks-nav-heading { margin: 12px 10px 4px; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--subtle); }
.tasks-nav-admin { margin: 12px 10px 4px; font-size: .85rem; }
.tasks-title { margin: 0 0 12px; }
.task-quick { display: flex; gap: 8px; padding: 10px; flex-wrap: wrap; align-items: center; }
.task-quick input[type="text"] { flex: 1 1 260px; width: auto; }
.task-quick input[type="date"] { flex: 0 0 170px; width: auto; }
.task-quick .btn { flex: none; }
.task-list { list-style: none; padding: 0; overflow: hidden; }
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: 0; }
.task form { margin: 0; }
.task-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); cursor: pointer; margin-top: 1px; padding: 0; flex: none; }
.task-check:hover { border-color: var(--primary); background: var(--primary-soft); }
.task.is-done .task-check { background: var(--ok); border-color: var(--ok); box-shadow: inset 0 0 0 3px var(--surface); }
.task-body { flex: 1; min-width: 0; }
.task-title { color: var(--text); text-decoration: none; font-weight: 550; }
.task-title:hover { text-decoration: underline; }
.task.is-done .task-title { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .85rem; color: var(--muted); margin-top: 2px; }
.task.is-overdue .task-due { color: var(--error); font-weight: 600; }
.empty-state { text-align: center; color: var(--muted); }
.link-button.danger { color: var(--error); }
.list-row { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.list-remove { margin: 4px 0 0; text-align: right; }
@media (max-width: 800px) { .tasks-layout { grid-template-columns: 1fr; } }

/* Gemeinsame Listen/Kalender: Sichtbarkeit */
fieldset.visibility { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px 12px; margin: 12px 0 0; }
fieldset.visibility legend { font-weight: 600; padding: 0 6px; }
fieldset.visibility select { width: auto; display: inline-block; margin-left: 6px; min-height: 32px; padding: 4px 8px; }
.visibility-people { margin: 4px 0 0 26px; }
details.card-inner { border-top: 1px solid var(--border); padding: 12px 0 4px; }
details.card-inner:first-of-type { border-top: 0; }

/* Wartungsmodus (Betreiber) */
.maintenance-card { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.maintenance-card > div { flex: 1 1 420px; }
.maintenance-card h2 { margin-top: 0; }
.maintenance-card.is-on { border-color: var(--error-border); background: var(--error-soft); }

/* Rückfrage-Fenster (statt window.confirm) */
.modal { width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 12px 40px rgba(12, 21, 28, .22); }
.modal::backdrop { background: rgba(12, 21, 28, .45); }
.modal[open] { animation: modal-in .14s ease-out; }
.modal-body { margin: 0; padding: 22px 22px 18px; }
.modal-title { margin: 0 0 8px; font: 600 1.15rem/1.3 var(--font-head); }
.modal-text { margin: 0 0 20px; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.modal .btn:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal[open] { animation: none; } }
@media (max-width: 480px) { .modal-actions .btn { flex: 1 1 auto; } }
