/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 15.5px; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 600; }
h1 { font-size: 1.95rem; letter-spacing: -.02em; margin: 0 0 .5rem; }
h2 { font-size: 1.4rem; letter-spacing: -.01em; margin: 0 0 .5rem; }
h3 { font-size: 1.08rem; margin: 0 0 .7rem; }
h4 { font-size: .82rem; color: var(--muted); margin: 0 0 .4rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.subtitle { margin: .3rem 0 0; color: var(--muted); max-width: 62ch; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem .8rem; z-index: 50; }
.skip-link:focus { left: .5rem; top: .5rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Kopfzeile ---------- */
.topbar { display: flex; align-items: center; gap: 1.5rem; padding: 0 1.25rem; height: 58px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 650; font-size: 1.05rem; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.topnav { display: flex; align-items: center; gap: .25rem; flex: 1; overflow-x: auto; white-space: nowrap; align-self: stretch; }
.topnav a { display: flex; align-items: center; height: 100%; color: var(--muted); padding: 0 .7rem; border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.topnav a:hover { color: var(--ink); text-decoration: none; }
.topnav a { position: relative; }
.topnav a.active { color: var(--ink); font-weight: 600; }
.tab-indicator { position: absolute; left: .7rem; right: .7rem; bottom: -3px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.app-name { font-weight: 600; padding-right: 1rem; margin-right: .5rem; border-right: 1px solid var(--line); }
.topbar-right { display: flex; align-items: center; gap: .8rem; }
.topbar-right form { margin: 0; }
.topbar-link { font-weight: 600; }
.avatar { display: inline-grid; vertical-align: middle; flex-shrink: 0; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); font-size: .8rem; font-weight: 650; }
.user-name { color: var(--muted); max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 650; cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent-strong); }
@media (max-width: 1000px) and (min-width: 861px) { .user-name { display: none; } .topbar { gap: .8rem; } }
:root { --topbar-h: 58px; }
.menu-toggle { display: none; }

/* ---------- Kopfzeile auf schmalen Bildschirmen ----------
   Zeile 1: Logo und Menü-Knopf. Zeile 2: die Seiten der App als wischbare Leiste.
   Das Menü klappt darunter auf (Designer, Hilfe, Hell/Dunkel, Sprache, Profil, Abmelden). */
@media (max-width: 860px) {
  :root { --topbar-h: 52px; --menu-open: .45s; --menu-close: .25s; --menu-ease: cubic-bezier(.2, .8, .2, 1); }
  .topbar { flex-wrap: wrap; height: auto; min-height: 52px; padding: 0 1rem; gap: 0 .75rem; }
  .brand { order: 1; height: 52px; }
  .menu-toggle { order: 2; display: grid; place-items: center; margin-left: auto; width: 40px; height: 40px; padding: 0; }
  /* Beide Symbole liegen übereinander; beim Öffnen dreht sich das Menü-Symbol zum X */
  .menu-toggle svg { grid-area: 1 / 1; width: 20px; height: 20px;
                     transition: transform var(--menu-close) var(--menu-ease), opacity var(--menu-close) var(--menu-ease); }
  .menu-toggle .i-close { opacity: 0; transform: rotate(-90deg) scale(.6); }
  .topbar.menu-open .menu-toggle .i-menu { opacity: 0; transform: rotate(90deg) scale(.6); }
  .topbar.menu-open .menu-toggle .i-close { opacity: 1; transform: none; }
  .topnav { order: 3; flex: 1 0 100%; height: 44px; margin: 0 -1rem; padding: 0 .5rem; border-top: 1px solid var(--line);
            scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav:empty { display: none; }
  .topnav a { padding: 0 .6rem; }
  .app-name { padding-right: .7rem; margin-right: .2rem; }
  /* Zu: ganz ausgeblendet (display: none). Zum Animieren blendet menu.js es kurz vorher ein
     (Klasse menu-active, zugeklappt) und nach dem Schließen wieder aus. Öffnen gleitet langsam auf,
     die Einträge folgen in der sichtbaren Reihenfolge; Schließen geht schneller. */
  .topbar-right { order: 4; flex: 1 0 100%; display: none; flex-wrap: wrap; align-items: center; gap: .6rem;
                  margin: 0 -1rem; padding: 0 1rem; border-top: 1px solid transparent;
                  max-height: 0; overflow: hidden; opacity: 0; transform: translateY(-.5rem);
                  transition: max-height var(--menu-close) var(--menu-ease), padding var(--menu-close) var(--menu-ease),
                              opacity var(--menu-close) ease, transform var(--menu-close) var(--menu-ease),
                              border-color var(--menu-close) ease; }
  .topbar.menu-active .topbar-right { display: flex; }
  .topbar.menu-open .topbar-right { max-height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: .4rem 1rem 1rem;
                                    opacity: 1; transform: none; border-top-color: var(--line);
                                    transition-duration: var(--menu-open); }
  .topbar-right > * { opacity: 0; transform: translateY(-.5rem);
                      transition: opacity .15s ease, transform .15s var(--menu-ease); }
  .topbar.menu-open .topbar-right > * { opacity: 1; transform: none; transition-duration: .35s; }
  .topbar.menu-open .topbar-right > .profile-link { transition-delay: .08s; }
  .topbar.menu-open .topbar-right > .topbar-link:nth-child(1) { transition-delay: .14s; }
  .topbar.menu-open .topbar-right > .topbar-link:nth-child(2) { transition-delay: .19s; }
  .topbar.menu-open .topbar-right > .topbar-link:nth-child(3) { transition-delay: .24s; }
  .topbar.menu-open .topbar-right > .theme-toggle,
  .topbar.menu-open .topbar-right > .lang-switch,
  .topbar.menu-open .topbar-right > .icon-btn { transition-delay: .29s; }
  .topbar.menu-open .topbar-right > .logout-form { transition-delay: .34s; }
  .topbar-right > .topbar-link, .topbar-right > .profile-link, .topbar-right > .logout-form { flex: 1 0 100%; }
  .topbar-right > .topbar-link, .topbar-right > .logout-form .link { display: block; padding: .7rem 0; border-bottom: 1px solid var(--line); text-align: left; width: 100%; font-size: 1rem; }
  .topbar-right > .profile-link { order: -1; padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .topbar-right > .logout-form { order: 10; }
  .topbar-right > .lang-switch { margin-top: .2rem; }
  .topbar-right > .theme-toggle { margin-top: .2rem; }
  .topbar-right .user-name { display: block; max-width: none; color: var(--ink); font-weight: 600; }
  .topbar-right .icon-btn { width: 40px; height: 40px; }
  .topbar-right > .logout-form .link { border-bottom: 0; border-top: 1px solid var(--line); margin-top: .4rem; color: var(--danger); }
  .designer-bar { position: static; }
}

.container { max-width: 1200px; margin: 0 auto; padding: 1.8rem 1.25rem 4rem; }
.messages { max-width: 1200px; margin: 1rem auto 0; padding: 0 1.25rem; }
.msg { background: var(--ok-soft); color: var(--ok); border-left: 4px solid var(--ok); padding: .6rem .9rem; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: .5rem; }
.msg-error { background: var(--danger-soft); color: var(--danger); border-left-color: var(--danger); }
.crumbs { color: var(--muted); margin: 0 0 .6rem; font-size: .92rem; }
.page-head, .head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.head-row { align-items: center; margin-bottom: .5rem; }
.page-head h1, .head-row h1, .head-row form { margin: 0; }

/* ---------- Raster: 12 Spalten ---------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.1rem; align-items: start; }
.col { grid-column: span 12; min-width: 0; }
@media (min-width: 800px) {
  .col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-6 { grid-column: span 6; } .col-8 { grid-column: span 8; }
}

/* ---------- Karten und Tabellen ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem; margin-bottom: 1.1rem; }
.grid .col > .card:last-child { margin-bottom: 0; }
.card.narrow { max-width: 580px; margin: 0 auto; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .7rem; }
.card-head h3 { margin: 0; }
.card-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .82rem; color: var(--muted); font-weight: 600; padding: .5rem .65rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .6rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline; margin-left: .7rem; }
.empty { color: var(--muted); padding: .6rem 0; margin: 0; }
.empty-state { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius-lg); padding: 2.5rem 1.5rem; text-align: center; }
.empty-state p { color: var(--muted); max-width: 52ch; margin: 0 auto 1.1rem; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: flex-end; padding-top: .7rem; }
.badge { display: inline-block; font-size: .74rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); padding: .05rem .5rem; border-radius: 99px; vertical-align: middle; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.step-no { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: .85rem; margin-right: .35rem; }
.block-error { border: 1px dashed var(--danger); color: var(--danger); border-radius: var(--radius); padding: .7rem .9rem; background: var(--surface); }
.block-locked { border: 1px solid var(--line); color: var(--muted); border-radius: var(--radius); padding: .7rem .9rem; background: var(--surface-2); }
.text-block { margin: 0; max-width: 72ch; }
.edit-link { display: inline-block; margin-top: 1.8rem; font-size: .88rem; }
pre.json { margin: 0; overflow: auto; max-height: 320px; font-size: .82rem; background: var(--surface-2); padding: .7rem; border-radius: var(--radius); }

/* ---------- Buttons und Formulare ---------- */
.btn { display: inline-block; font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: var(--radius); padding: .5rem 1rem; cursor: pointer; text-align: center; }
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--muted); }
.btn-danger, .btn-danger:hover { background: var(--danger); border-color: var(--danger); }
.btn-block { display: block; width: 100%; padding: .65rem 1rem; }
.btn-small { padding: .3rem .65rem; font-size: .86rem; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--accent-strong); cursor: pointer; }
button.link:hover { text-decoration: underline; }
.danger { color: var(--danger) !important; }

input[type=text], input[type=search], input[type=number], input[type=email], input[type=url], input[type=date], input[type=password], select, textarea {
  font: inherit; color: inherit; width: 100%; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; }
.form > div { margin-bottom: .9rem; }
.form label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .25rem; }
.form .helptext { display: block; color: var(--muted); font-size: .82rem; margin-top: .2rem; }
ul.errorlist { list-style: none; margin: 0 0 .25rem; padding: 0; color: var(--danger); font-size: .86rem; }
.form div > div label { font-weight: 400; }
.form > div:has(> input[type=checkbox]) { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: .1rem; }
.form > div:has(> input[type=checkbox]) label { margin: 0; font-weight: 400; }
.form > div:has(> input[type=checkbox]) .helptext { flex-basis: 100%; order: -1; margin: .15rem 0 0 1.5rem; }
.form > div:has(> input[type=checkbox]) { flex-direction: row; justify-content: flex-start; }
.form > div:has(> input[type=checkbox]) > label { order: 2; }
.form > div:has(> input[type=checkbox]) > input { order: 1; }
.form > div:has(> input[type=checkbox]) > .helptext { order: 3; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem .8rem; margin: 0; }
legend { font-weight: 600; font-size: .88rem; padding: 0 .3rem; }
.form input[type=checkbox] { margin-right: .45rem; accent-color: var(--accent); width: 1rem; height: 1rem; }
.actions { display: flex; gap: .5rem; }
.inline-form { display: flex; gap: .5rem; margin-top: .9rem; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 180px; }
.search { display: flex; gap: .4rem; margin: 0; }
.search input { width: 210px; }

/* ---------- Startseite: Begrüßung ---------- */
.home-hero { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; overflow: hidden;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.8rem 2rem; margin-bottom: 2rem; }
.home-hero h1 { margin: .1rem 0 0; }
.home-date { margin: 0; color: var(--accent-strong); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.home-stats { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 0; }
.stat-chip { background: var(--surface); border: 1px solid var(--line); border-radius: 99px; padding: .2rem .75rem; font-size: .88rem; color: var(--muted); }
.stat-chip strong { color: var(--ink); }
.home-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; }
.home-hero-art { flex: none; width: 220px; height: 160px; }
.home-hero-art .art-a { fill: var(--c1); }
.home-hero-art .art-b { fill: var(--c1); opacity: .35; }
.home-hero-art .art-c { fill: var(--c2); }
.home-hero-art .art-d { fill: var(--c3); opacity: .55; }
@media (max-width: 720px) {
  .home-hero { padding: 1.3rem 1.2rem; }
  .home-hero-art { display: none; }
}
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 2.2rem 0 .9rem; }
.home-hero + .section-head { margin-top: 0; }
.section-head h2 { margin: 0; font-size: 1.15rem; }
.section-head input[type=search] { max-width: 280px; }

/* ---------- Startseite: App-Kacheln ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.tile { display: flex; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.1rem 1.2rem; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, transform .15s; }
.tile[hidden] { display: none; }
.tile:hover, .tile:focus-visible { border-color: var(--accent); text-decoration: none; box-shadow: 0 6px 18px -10px var(--shadow); transform: translateY(-2px); }
.tile-icon { display: grid; place-items: center; flex: none; width: 54px; height: 54px; border-radius: 12px; background: var(--accent-soft); font-size: 1.6rem; }
.tile-icon.tone-1 { background: color-mix(in srgb, var(--c1) 18%, var(--surface)); }
.tile-icon.tone-2 { background: color-mix(in srgb, var(--c2) 20%, var(--surface)); }
.tile-icon.tone-3 { background: color-mix(in srgb, var(--c3) 20%, var(--surface)); }
.tile-icon.tone-4 { background: color-mix(in srgb, var(--c4) 20%, var(--surface)); }
.tile-icon.tone-5 { background: color-mix(in srgb, var(--c5) 18%, var(--surface)); }
.tile-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tile-name { font-weight: 600; font-size: 1.05rem; }
.tile-text { color: var(--muted); font-size: .92rem; }
.tile-meta { color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.tile-arrow { color: var(--muted); font-size: 1.2rem; opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .15s; }
.tile:hover .tile-arrow, .tile:focus-visible .tile-arrow { opacity: 1; transform: none; color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .tile, .tile-arrow { transition: none; } .tile:hover { transform: none; } }

/* ---------- Startseite: Schnellzugriff ---------- */
.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; }
.quick-link { display: flex; gap: .8rem; align-items: center; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.quick-link:hover { border-color: var(--accent); text-decoration: none; }
.quick-link > span:last-child { display: flex; flex-direction: column; }
.quick-icon { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); font-size: 1.1rem; }
.quick-link-form { margin: 0; display: contents; }
button.quick-link { font: inherit; text-align: left; cursor: pointer; width: 100%; }

/* ---------- Einführung „Deine erste App“: Begleiter unten rechts ---------- */
.coach { position: fixed; right: 1rem; bottom: 1rem; z-index: 40; width: 360px; max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 6rem); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius-lg);
  box-shadow: 0 14px 40px -12px var(--shadow); }
.coach-head { display: flex; align-items: center; gap: .7rem; padding: .75rem .9rem .5rem; }
.coach-badge { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); font-size: 1.1rem; flex: none; }
.coach-head-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.coach-toggle span[aria-hidden] { display: inline-block; transition: transform .15s; }
.coach.collapsed .coach-toggle span[aria-hidden] { transform: rotate(180deg); }
.coach-progress { display: flex; gap: 4px; padding: 0 .9rem .6rem; }
.coach-dot { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.coach-dot.done { background: var(--ok); }
.coach-dot.current { background: var(--accent); }
.coach-body { padding: 0 .9rem .8rem; overflow-y: auto; }
.coach.collapsed .coach-body { display: none; }
.coach-step { margin: 0; color: var(--accent-strong); font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.coach-title { font-size: 1.05rem; margin: .15rem 0 .35rem; }
.coach-text { margin: 0 0 .7rem; }
.coach-code { font-size: .78rem; max-height: 180px; overflow: auto; margin: 0 0 .5rem; }
.coach-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .6rem 0 .4rem; }
.coach-note { margin: .2rem 0 .4rem; }
.coach-ideas { margin: .2rem 0 .6rem; padding-left: 1.1rem; }
.coach-stop { margin: .2rem 0 0; }
@media (max-width: 720px) {
  .coach { left: .5rem; right: .5rem; bottom: .5rem; width: auto; max-width: none; max-height: 55vh; }
}
/* Platz unter dem Inhalt, damit nichts dauerhaft unter dem Begleiter liegt */
body:has(#coach) main { padding-bottom: 16rem; }
body:has(#coach.collapsed) main { padding-bottom: 6rem; }
/* Ziel des aktuellen Schritts kurz aufleuchten lassen */
.coach-glow { outline: 3px solid var(--accent); outline-offset: 4px; border-radius: var(--radius); animation: coach-pulse 1.4s ease-out 3; }
@keyframes coach-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
@media (prefers-reduced-motion: reduce) { .coach-glow { animation: none; } }

/* ---------- Anmeldung ---------- */
.login { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); min-height: 100vh; }
.login-side { background: var(--brand-panel); color: #fff; padding: 2.5rem clamp(1.5rem, 4vw, 3.5rem); display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; }
.login-brand { display: flex; align-items: center; gap: .7rem; font-size: 1.3rem; font-weight: 650; letter-spacing: -.01em; }
.login-art { width: 100%; max-width: 440px; align-self: center; }
.art-panel { fill: rgba(255, 255, 255, .09); }
.art-soft { fill: rgba(255, 255, 255, .28); }
.art-strong { fill: rgba(255, 255, 255, .92); }
.art-accent { fill: var(--c2); }
.login-claim h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); letter-spacing: -.02em; max-width: 18ch; margin-bottom: .5rem; }
.login-claim p { color: rgba(255, 255, 255, .78); margin: 0; }
.login-main { display: grid; place-items: center; padding: 2rem 1.25rem; background: var(--surface); }
.login-box { width: 100%; max-width: 380px; }
.login-box h1 { margin-bottom: 1.3rem; }
.login-or { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .86rem; margin: 1.2rem 0; }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.login-help { margin-top: 1.5rem; }
@media (max-width: 820px) {
  /* Untereinander: Kopf nur so hoch wie sein Inhalt, das Formular bekommt den Rest. Ohne
     grid-template-rows teilt min-height: 100vh die Höhe auf beide Zeilen auf. */
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-main { place-items: start center; padding-top: 4.25rem; }
  .login-side { padding: 1.5rem 1.25rem; }
  .login-art, .login-claim p { display: none; }
  .login-side { gap: .75rem; justify-content: flex-start; }
  .login-claim h2 { max-width: none; margin: 0; font-size: 1.15rem; }
}

/* ---------- Bausteine ---------- */
.heading-block { padding: .2rem 0; }
.heading-block h1, .heading-block h2, .heading-block h3 { margin: 0; }
.greeting h1 { margin: 0; }
.greeting-date { color: var(--muted); margin: 0 0 .15rem; font-size: .92rem; }
.button-block { display: flex; padding: .35rem 0; }
.button-block form { margin: 0; }
.button-block.align-right { justify-content: flex-end; }
@media (max-width: 799px) { .button-block.align-right { justify-content: flex-start; } }

.notice { display: flex; flex-direction: column; gap: .15rem; padding: .8rem 1rem; border-radius: 0 var(--radius) var(--radius) 0; border-left: 4px solid var(--accent); background: var(--accent-soft); }
.notice-success { border-left-color: var(--ok); background: var(--ok-soft); }
.notice-warning { border-left-color: var(--c2); background: var(--warn-soft); }
.notice-danger { border-left-color: var(--danger); background: var(--danger-soft); }
.image-block { margin: 0; }
.image-block img { display: block; max-width: 100%; height: auto; border-radius: var(--radius-lg); }
.image-block figcaption { color: var(--muted); font-size: .86rem; margin-top: .4rem; }
.divider { border: 0; border-top: 1px solid var(--line); margin: .4rem 0; }
.spacer-s { height: .5rem; } .spacer-m { height: 1.5rem; } .spacer-l { height: 3rem; }

/* Kennzahl und Fortschritt: die farbige Oberkante kennzeichnet Messwerte */
.stat { container-type: inline-size; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding: .95rem 1.25rem 1.1rem; }
.stat-label { color: var(--muted); font-size: .92rem; }
.stat-success { border-top-color: var(--ok); background: linear-gradient(var(--ok-soft), var(--surface) 70%); }
.stat-warning { border-top-color: var(--c2); background: linear-gradient(var(--warn-soft), var(--surface) 70%); }
.stat-danger { border-top-color: var(--danger); background: linear-gradient(var(--danger-soft), var(--surface) 70%); }
.stat-delta { font-size: .85rem; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.stat-delta.is-good { color: var(--ok); }
.stat-delta.is-bad { color: var(--danger); }
.stat-delta .muted { color: var(--muted); font-size: .78rem; }
.stat-value { font-size: clamp(1.35rem, 13cqi, 2.35rem); font-weight: 600; line-height: 1.15; letter-spacing: -.025em; font-variant-numeric: tabular-nums; margin-top: .1rem; }
.stat-unit { font-size: 1.1rem; font-weight: 500; color: var(--muted); margin-left: .3rem; letter-spacing: 0; }
.progress-track { background: var(--bg); border-radius: 3px; height: 8px; overflow: hidden; margin-top: .6rem; }
.progress-fill { display: block; height: 100%; background: var(--accent); }
.progress-note { color: var(--muted); font-size: .86rem; margin-top: .35rem; font-variant-numeric: tabular-nums; }

/* Balkendiagramm als Rangliste */
.bar-row { display: grid; grid-template-columns: minmax(90px, 32%) 1fr minmax(2.5ch, auto) minmax(4.5ch, auto); gap: .7rem; align-items: center; padding: .45rem 0; border-top: 1px solid var(--line); }
.bar-row:first-of-type { border-top: 0; }
.bar-label, .legend-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--bg); border-radius: 2px; height: 8px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.bar-count { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.bar-share { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .86rem; text-align: right; }

/* Kreisdiagramm */
.donut-wrap { display: flex; flex-wrap: wrap; gap: 1rem 1.4rem; align-items: center; }
.donut { flex: 0 1 170px; min-width: 120px; }
.legend { flex: 1 1 190px; min-width: 0; }
.donut circle { fill: none; stroke-width: 5.5; }
.donut-ring { stroke: var(--bg); }
.donut-total { font-size: 7px; font-weight: 600; text-anchor: middle; fill: var(--ink); }
.donut-caption { font-size: 2.7px; text-anchor: middle; fill: var(--muted); }
.seg-1 { stroke: var(--c1); background: var(--c1); } .seg-2 { stroke: var(--c2); background: var(--c2); }
.seg-3 { stroke: var(--c3); background: var(--c3); } .seg-4 { stroke: var(--c4); background: var(--c4); }
.seg-5 { stroke: var(--c5); background: var(--c5); } .seg-6 { stroke: var(--c6); background: var(--c6); }
.legend { list-style: none; margin: 0; padding: 0; }
.legend li { display: grid; grid-template-columns: 12px 1fr 2.5ch 4.5ch; gap: .6rem; align-items: center; padding: .3rem 0; }
.swatch { width: 12px; height: 12px; border-radius: 3px; }

/* Verlauf: Säulen pro Monat */
.columns { display: flex; align-items: stretch; gap: 6px; height: 190px; }
.column { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.column.new-year { border-left: 1px dashed var(--line); padding-left: 5px; }
.column-area { position: relative; flex: 1; width: 100%; max-width: 38px; margin-top: 1.4rem; border-bottom: 1px solid var(--line); }
.column-bar { position: absolute; left: 0; right: 0; bottom: 0; height: var(--h); background: var(--accent); border-radius: 3px 3px 0 0; }
.column-count { position: absolute; left: 0; right: 0; bottom: calc(var(--h) + 2px); text-align: center; font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.column-label { font-size: .76rem; color: var(--muted); margin-top: .3rem; }

/* Liniendiagramm: SVG gestreckt auf die Breite, Linie bleibt dank non-scaling-stroke gleich dick */
.line-chart { display: grid; gap: .3rem; }
.line-top { font-variant-numeric: tabular-nums; }
.line-plot { position: relative; height: 180px; }
.line-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.line-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.line-area { fill: var(--accent); opacity: .12; }
.line-path { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.line-hits { position: absolute; inset: 0; display: flex; }
.line-hits span { flex: 1; }
.line-hits span:hover { background: linear-gradient(to right, transparent calc(50% - 1px), var(--line) calc(50% - 1px), var(--line) calc(50% + 1px), transparent calc(50% + 1px)); }
.line-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; }
.line-labels { display: flex; font-size: .76rem; color: var(--muted); }
.line-labels span { flex: 1; text-align: center; white-space: nowrap; overflow: visible; }

/* Tableau-Ansicht */
.tableau-card tableau-viz { display: block; width: 100%; min-height: 200px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.tableau-hint { margin: .5rem 0 0; }

/* Karten und Seitenkacheln */
.record-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.record-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .9rem 1rem; }
.record-title { font-size: 1rem; color: var(--ink); margin: 0 0 .5rem; }
.record-card dl { margin: 0; }
.record-card dl div { display: flex; justify-content: space-between; gap: .8rem; padding: .22rem 0; border-top: 1px solid var(--line); font-size: .9rem; }
.record-card dt { color: var(--muted); }
.record-card dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.page-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.page-link { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; padding: .8rem 1rem; font-weight: 600; color: var(--ink); }
.page-link:hover { border-color: var(--accent); text-decoration: none; }

/* ---------- Seiten-Designer ---------- */
main.designer { padding: 0; }
.designer-bar { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.25rem; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: var(--topbar-h); z-index: 10; }
.designer-bar #page-title { width: 240px; font-weight: 600; }
.designer-bar #status { flex: 1; text-align: right; }
.page-access { position: relative; }
.page-access > summary { cursor: pointer; list-style: none; padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 6px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.page-access > summary::-webkit-details-marker { display: none; }
.page-access > summary::after { content: " ▾"; color: var(--muted); }
.page-access[open] > summary { border-color: var(--accent, currentColor); }
.page-access-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; min-width: 240px; max-width: min(320px, calc(100vw - 32px)); max-height: 60vh; overflow: auto; padding: .6rem .75rem; display: grid; gap: .35rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); }
.page-access-menu p { margin: .25rem 0 0; }
.designer-actions { display: flex; gap: .5rem; }
.check { display: flex; align-items: center; gap: .35rem; white-space: nowrap; }
.designer-body { display: grid; grid-template-columns: 250px minmax(0, 1fr) 310px; min-height: calc(100vh - 116px); }
.panel { background: var(--surface); padding: 1rem; border-right: 1px solid var(--line); }
.panel#props { border-right: 0; border-left: 1px solid var(--line); }
@media (min-width: 901px) {
  .panel { position: sticky; top: 116px; align-self: start; height: calc(100vh - 116px); overflow-y: auto; }
}
#palette h4 { margin: 1.1rem 0 .4rem; }
.bicon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pal-item { display: flex; align-items: center; gap: .6rem; width: 100%; font: inherit; text-align: left; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .45rem .6rem; margin-bottom: .35rem; cursor: grab; }
.pal-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.pal-item .bicon { color: var(--accent-strong); }
.pal-text { display: flex; flex-direction: column; min-width: 0; }
.pal-label { font-weight: 600; font-size: .92rem; }
.pal-hint { color: var(--muted); font-size: .76rem; line-height: 1.25; }
.canvas-wrap { padding: 1.25rem; min-width: 0; }
.conflict-actions { margin-top: .45rem; }
.designer-hints { margin: .6rem 0 0; }
.designer-hints kbd { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .78rem; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: .05rem .35rem; color: var(--ink); }
#canvas { min-height: 60vh; padding: 1rem; border: 2px dashed var(--line); border-radius: var(--radius-lg); align-content: start; background: var(--bg); }
#canvas.over { border-color: var(--accent); background: var(--accent-soft); }
.canvas-hint { grid-column: span 12; display: flex; flex-direction: column; gap: .2rem; text-align: center; color: var(--muted); padding: 4rem 1rem; }
.canvas-hint strong { color: var(--ink); font-size: 1.05rem; }
.block-unknown { display: flex; flex-direction: column; gap: .25rem; padding: .9rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.block-unknown strong { color: var(--ink); }
.update-note .update-actions { margin-top: .45rem; display: flex; gap: .5rem; flex-wrap: wrap; }
.dblock { border: 1px solid transparent; border-radius: var(--radius); padding: 0 .35rem .35rem; cursor: grab; outline-offset: 0; }
.dblock:hover { border-color: var(--line); background: rgba(255, 255, 255, .5); }
.dblock.selected { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.dblock.is-drag-source { opacity: .4; }
.dblock.drop-before { box-shadow: -4px 0 0 var(--accent); }
.dblock.drop-after { box-shadow: 4px 0 0 var(--accent); }
.snippet-bar { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .25rem; }
.placeholder-chip { cursor: pointer; border: 1px solid var(--line); background: var(--bg); font-family: inherit; }
.placeholder-chip:hover { border-color: var(--accent); color: var(--accent-strong); }
.create-card { scroll-margin-top: calc(var(--topbar-h) + 1rem); }
.badge-warn { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.tile-notices { display: flex; flex-direction: column; gap: .15rem; margin-top: .25rem; }
.tile-notice { font-size: .78rem; color: var(--ink); background: var(--accent-soft); padding: .15rem .45rem; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Widget-Auswahl (Startseite): Dialog, am Handy als Sheet von unten */
.widget-sheet { box-sizing: border-box; width: min(820px, calc(100vw - 2rem)); max-height: min(86vh, 900px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); margin: auto; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px var(--shadow); overflow: hidden; display: none; flex-direction: column; }
.widget-sheet[open] { display: flex; }
.widget-sheet::backdrop { background: rgba(10, 16, 24, .55); backdrop-filter: blur(2px); }
.widget-sheet *, .widget-sheet *::before, .widget-sheet *::after { box-sizing: border-box; }
.widget-sheet-head { display: flex; align-items: flex-start; gap: 1rem; padding: 1.1rem 1.25rem .8rem; border-bottom: 1px solid var(--line); }
.widget-sheet-title { flex: 1; min-width: 0; }
.widget-sheet-title h3 { margin: 0; font-size: 1.15rem; }
.widget-sheet-title p { margin: .2rem 0 0; }
.widget-sheet-close { flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; margin: -.3rem -.4rem 0 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.widget-sheet-close:hover, .widget-sheet-close:focus-visible { background: var(--surface-2); color: var(--ink); }
.widget-sheet-search { display: block; width: 100%; margin: .8rem 0 0; }
.widget-sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: .25rem 1.25rem 1.25rem; }
.widget-app { border-bottom: 1px solid var(--line); }
.widget-app:last-of-type { border-bottom: 0; }
.widget-app summary { display: flex; align-items: center; gap: .75rem; padding: .75rem .25rem; margin: 0 -.25rem; border-radius: var(--radius); cursor: pointer; list-style: none; }
.widget-app summary:hover { background: var(--surface-2); }
.widget-app summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.widget-app summary::-webkit-details-marker { display: none; }
.widget-app summary::after { content: ""; flex: none; width: .5rem; height: .5rem; margin: 0 .35rem 0 .25rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
.widget-app[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.widget-app .tile-icon { width: 2.25rem; height: 2.25rem; border-radius: 10px; font-size: 1.15rem; }
.widget-app-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-app-count { white-space: nowrap; }
.widget-app-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: .75rem; padding: .25rem 0 1rem; }
.widget-option { margin: 0; }
.widget-option[hidden] { display: none; }
.widget-option-btn { position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; text-align: left; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; overflow: hidden; font: inherit; color: inherit; transition: border-color .15s, box-shadow .15s; }
.widget-option-btn:hover, .widget-option-btn:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); outline: none; }
.widget-option-add { position: absolute; top: .45rem; right: .45rem; z-index: 1; display: grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; line-height: 1; opacity: 0; transform: scale(.8); transition: opacity .15s, transform .15s; }
.widget-option-btn:hover .widget-option-add, .widget-option-btn:focus-visible .widget-option-add { opacity: 1; transform: none; }
@media (hover: none) { .widget-option-add { opacity: 1; transform: none; } }
/* Vorschau: der echte Baustein, verkleinert und ohne eigenen Rahmen, damit keine Karte in der Karte entsteht */
.widget-option-preview { position: relative; display: block; height: 116px; overflow: hidden; pointer-events: none; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.widget-option-preview::after { content: ""; position: absolute; inset: auto 0 0; height: 28px; background: linear-gradient(transparent, var(--surface-2)); }
.widget-option-preview .card, .widget-option-preview .stat, .widget-option-preview .cards-block, .widget-option-preview section { margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.widget-option-preview > * { width: 133.33%; transform: scale(.75); transform-origin: top left; padding: .75rem .95rem; }
.widget-option-preview .card-head { margin-bottom: .4rem; }
.widget-option-preview .card-tools, .widget-option-preview .btn, .widget-option-preview form, .widget-option-preview .pager { display: none; }
.widget-option-preview .muted.small:only-child { display: block; padding-top: 2rem; text-align: center; }
.widget-option-text { display: flex; flex-direction: column; gap: .1rem; padding: .55rem .75rem .65rem; }
.widget-option-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget-sheet [data-widget-sheet-empty] { margin: 1.5rem 0 .5rem; }
html.sheet-open { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) {
  .widget-sheet[open] { animation: widget-sheet-in .18s ease-out; }
  .widget-sheet[open]::backdrop { animation: widget-sheet-fade .18s ease-out; }
}
@keyframes widget-sheet-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@keyframes widget-sheet-fade { from { opacity: 0; } }
/* Handy: Sheet von unten mit Griff, volle Breite */
@media (max-width: 640px) {
  .widget-sheet { width: 100vw; max-width: 100vw; max-height: 88vh; margin: auto 0 0; border-radius: 18px 18px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  .widget-sheet-head { position: relative; padding-top: 1.4rem; }
  .widget-sheet-head::before { content: ""; position: absolute; left: 50%; top: .55rem; width: 40px; height: 4px; border-radius: 4px; background: var(--line); transform: translateX(-50%); }
  .widget-app-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .widget-option-preview { height: 92px; }
  @keyframes widget-sheet-in { from { transform: translateY(100%); } }
}
.home-widgets { margin-bottom: 1.5rem; align-items: stretch; }  /* Widgets einer Reihe gleich hoch */
.home-widget-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; }
.home-widget-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .45rem; min-width: 0; }
.home-widget-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-widget-body { flex: 1; min-width: 0; }
.home-widget-body .card, .home-widget-body .stat { margin-bottom: 0; }
/* Keine Karte in der Karte: Der Baustein übernimmt den Rahmen des Widgets */
.home-widget-body > .card, .home-widget-body > section.card { border: 0; background: transparent; box-shadow: none; padding: 0; }
.home-widget-card { overflow: hidden; }
/* Kennzahlen füllen das Widget bis zum Rand; die Ampel-Linie trennt sie vom Titel */
.home-widget-body > .stat { height: calc(100% + .75rem); margin: 0 -.9rem -.75rem; border-width: 3px 0 0; border-radius: 0; }
.widget-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.widget-arrange-bar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.widget-arrange-bar[hidden], .home-widget-tools[hidden] { display: none; }
.home-widget-tools { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; margin-bottom: .55rem; }
.home-widget-tools button { min-width: 2rem; height: 2rem; padding: 0 .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: .9rem; cursor: pointer; }
.home-widget-tools button:hover, .home-widget-tools button:focus-visible { border-color: var(--accent); }
.home-widget-tools button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.home-widget-sizes { display: inline-flex; gap: .25rem; margin-left: auto; }
.home-widgets.is-arranging .home-widget-card { outline: 2px dashed var(--line); outline-offset: 3px; cursor: grab; }
.home-widgets.is-arranging .home-widget-body { pointer-events: none; opacity: .8; }  /* beim Anordnen keine Klicks in den Inhalt */
.home-widget-card.is-dragged { opacity: .4; }
/* Schmal sind alle Widgets ganz breit und stehen untereinander: Breite ausblenden, Pfeile nach oben/unten */
@media (max-width: 799px) { .home-widget-sizes { display: none; } .home-widget-tools [data-move] { transform: rotate(90deg); } }
/* ---------- Data-Science-Visualisierungen ---------- */
.chart-filter-link { color: inherit; text-decoration: none; border-bottom: 1px dashed var(--muted); }
.chart-filter-link:hover { color: var(--accent-strong); border-bottom-color: var(--accent); }
.line-band { fill: var(--accent-soft); opacity: .55; }
.line-threshold { stroke: var(--danger); stroke-width: 1.5; stroke-dasharray: 4 3; }
.line-anomaly { fill: var(--danger); stroke: var(--surface); stroke-width: 1.5; }
.scatter-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; margin-bottom: .4rem; }
.scatter-wrap { display: grid; grid-template-columns: auto 1fr; gap: .35rem; align-items: stretch; }
.scatter-axis-y { display: flex; flex-direction: column; justify-content: space-between; text-align: right; padding: .2rem 0 1.45rem; font-variant-numeric: tabular-nums; }
.scatter-stage { min-width: 0; }
.scatter-svg { width: 100%; height: auto; aspect-ratio: 2 / 1; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); display: block; }
.scatter-trend { stroke: var(--accent-strong); stroke-width: 2.2; stroke-dasharray: 6 4; opacity: .8; }
.scatter-dot { fill: var(--c1); stroke: var(--surface); stroke-width: 1.5; opacity: .9; cursor: pointer; transition: r .12s; }
.scatter-dot.seg-2 { fill: var(--c2); }
.scatter-dot.seg-3 { fill: var(--c3); }
.scatter-dot.seg-4 { fill: var(--c4); }
.scatter-dot.seg-5 { fill: var(--c5); }
.scatter-axis-x { display: flex; justify-content: space-between; gap: .5rem; padding: .25rem .2rem 0; font-variant-numeric: tabular-nums; }
.scatter-axis-x span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scatter-legend { display: flex; flex-wrap: wrap; gap: .6rem .9rem; margin-top: .55rem; }
.boxplot-scale { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .4rem; }
.boxplot-rows { display: flex; flex-direction: column; gap: .65rem; }
.boxplot-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: .55rem; align-items: center; }
@media (max-width: 640px) {
  .scatter-block .card-head, .boxplot-block .card-head, .heatmap-block .card-head { flex-wrap: wrap; gap: .2rem .6rem; }
  .boxplot-row { grid-template-columns: 1fr auto; gap: .25rem .5rem; }
  .boxplot-track { grid-column: 1 / -1; order: 3; }
}
.boxplot-track { position: relative; height: 26px; background: var(--bg); border-radius: 6px; border: 1px solid var(--line); }
.boxplot-whisker { position: absolute; top: 12px; height: 2px; background: var(--muted); }
.boxplot-cap { position: absolute; top: 7px; width: 2px; height: 12px; background: var(--muted); transform: translateX(-1px); }
.boxplot-box { position: absolute; top: 4px; height: 18px; border-radius: 4px; background: color-mix(in srgb, var(--c1) 35%, var(--surface)); border: 1.5px solid var(--c1); }
.boxplot-box.seg-2 { background: color-mix(in srgb, var(--c2) 35%, var(--surface)); border-color: var(--c2); }
.boxplot-box.seg-3 { background: color-mix(in srgb, var(--c3) 35%, var(--surface)); border-color: var(--c3); }
.boxplot-box.seg-4 { background: color-mix(in srgb, var(--c4) 35%, var(--surface)); border-color: var(--c4); }
.boxplot-box.seg-5 { background: color-mix(in srgb, var(--c5) 35%, var(--surface)); border-color: var(--c5); }
.boxplot-median { position: absolute; top: 3px; width: 2.5px; height: 20px; background: var(--ink); transform: translateX(-1px); }
.boxplot-mean { position: absolute; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink); transform: translateX(-4px); }
.boxplot-outlier { position: absolute; top: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); transform: translateX(-3px); }
.heatmap-table th, .heatmap-table td { text-align: center; padding: .45rem .55rem; }
.heatmap-table th[scope="row"] { text-align: left; }
.heat-cell { font-variant-numeric: tabular-nums; font-weight: 600; border-radius: 4px; }
.heat-link { color: inherit; text-decoration: none; display: block; }
.heat-pos-1 { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.heat-pos-2 { background: color-mix(in srgb, var(--accent) 28%, var(--surface)); }
.heat-pos-3 { background: color-mix(in srgb, var(--accent) 46%, var(--surface)); }
.heat-pos-4 { background: color-mix(in srgb, var(--accent) 68%, var(--surface)); color: #fff; }
.heat-neg-1 { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); }
.heat-neg-2 { background: color-mix(in srgb, var(--danger) 28%, var(--surface)); }
.heat-neg-3 { background: color-mix(in srgb, var(--danger) 46%, var(--surface)); }
.heat-neg-4 { background: color-mix(in srgb, var(--danger) 68%, var(--surface)); color: #fff; }
.dblock-type { display: flex; gap: .35rem; align-items: center; font-size: .74rem; color: var(--muted); padding: .2rem 0; }
.dblock-type .bicon { width: 14px; height: 14px; }
.dblock.selected .dblock-type { color: var(--accent-strong); font-weight: 600; }
.dblock-body { pointer-events: none; }
.dblock-body .card, .dblock-body .stat { margin-bottom: 0; }
.props-head { display: flex; align-items: center; gap: .5rem; font-size: 1.05rem; margin-bottom: .2rem; color: var(--accent-strong); }
.props-head strong { color: var(--ink); }
.prop { margin-bottom: .85rem; }
.prop label { display: block; font-weight: 600; font-size: .84rem; margin-bottom: .25rem; }
.prop.check-prop label { display: flex; align-items: center; gap: .45rem; font-weight: 400; }
.prop-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.only-narrow { display: none; }
@media (max-width: 900px) {
  .designer-body { grid-template-columns: 1fr; }
  .panel { border: 0; border-bottom: 1px solid var(--line); }
  .designer-bar { position: static; }
  /* Reihenfolge auf dem Handy: Seite, Einstellungen des gewählten Bausteins, Bausteine zum Hinzufügen */
  .canvas-wrap { order: 1; padding: .75rem; }
  .panel#props { order: 2; border-left: 0; border-top: 1px solid var(--line); }
  #palette-panel { order: 3; scroll-margin-top: calc(var(--topbar-h) + .5rem); }
  #props { scroll-margin-top: calc(var(--topbar-h) + .5rem); }
  #canvas { min-height: 40vh; padding: .5rem; }
  .only-narrow { display: inline-block; }
  .designer-bar { gap: .6rem; padding: .6rem 1rem; }
  .designer-bar #page-title { width: 100%; flex: 1 0 100%; order: 2; }
  .designer-bar .check { order: 3; }
  .designer-bar #status { order: 4; text-align: left; flex: 1 0 100%; }
  .designer-actions { order: 5; flex: 1 0 100%; }
  .designer-actions .btn { flex: 1; }
}

/* ---------- Führung ---------- */
.tour-blocker { position: fixed; inset: 0; z-index: 90; }
.tour-hole { position: fixed; z-index: 91; border-radius: var(--radius); box-shadow: 0 0 0 9999px rgba(15, 23, 32, .58); pointer-events: none; transition: top .2s, left .2s, width .2s, height .2s; }
.tour-popup { position: fixed; z-index: 92; width: min(380px, calc(100vw - 16px)); background: var(--surface); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem 1rem; box-shadow: 0 12px 40px var(--shadow); }
.tour-count { color: var(--muted); font-size: .8rem; margin: 0 0 .2rem; }
.tour-title { font-size: 1.15rem; margin: 0 0 .4rem; }
.tour-text { margin: 0 0 1rem; }
.tour-actions { display: flex; align-items: center; gap: .5rem; }
.tour-spacer { flex: 1; }
@media (prefers-reduced-motion: reduce) { .tour-hole { transition: none; } }

/* ---------- Sprache, Firmenlogo ---------- */
.lang-switch { display: flex; margin: 0; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.lang-switch button { font: inherit; font-size: .78rem; font-weight: 600; border: 0; background: var(--surface); color: var(--muted); padding: .28rem .55rem; cursor: pointer; }
.lang-switch button.current { background: var(--accent-soft); color: var(--accent-strong); }
/* Firmenlogo rechts neben „Baukasten“, getrennt durch eine senkrechte Linie („|“) */
.brand-logo { height: 22px; width: auto; max-width: 150px; margin-left: .3rem; padding-left: .85rem; border-left: 1px solid var(--line); box-sizing: content-box; }
.login-brand .brand-logo { height: 24px; background: #fff; padding: 7px 10px; border-radius: 6px; border-left: 0; margin-left: .75rem; }
.login-main { position: relative; }
.login-lang { position: absolute; top: 1.25rem; right: 1.25rem; display: flex; align-items: center; gap: .6rem; }

/* ---------- Eigene Bausteine, API, Versionen ---------- */
code.key { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .8rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: .05rem .35rem; color: var(--muted); }
textarea.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .86rem; line-height: 1.45; }
.custom-preview { border: 1px dashed var(--line); border-radius: var(--radius); padding: 1rem; background: var(--bg); }
.custom-block > .card:last-child { margin-bottom: 0; }
.palette-foot { margin: 1rem 0 0; }
.preset-box { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); display: grid; gap: .45rem; justify-items: start; }
.preset-box label { font-weight: 600; font-size: .84rem; }
.preset-box p { margin: 0; }
.key-reveal { margin-bottom: 1.1rem; }
.key-value { display: block; margin-top: .4rem; padding: .5rem .7rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92rem; overflow-wrap: anywhere; user-select: all; }
.check-line { display: flex; align-items: center; gap: .45rem; font-weight: 400 !important; margin-bottom: .35rem !important; }
.key-form { margin-top: .7rem; }
h4.spaced { margin-top: 1.3rem; }
.versions { margin-top: .8rem; }
.version-meta { display: block; }
input[type=file] { font: inherit; max-width: 100%; }

/* ---------- Skripte, Datenquellen ---------- */
.toasts { position: fixed; right: 1.25rem; bottom: 1.25rem; display: grid; gap: .5rem; z-index: 60; max-width: min(420px, calc(100vw - 2.5rem)); }
.toast { background: var(--ink); color: var(--bg); padding: .7rem 1rem; border-radius: var(--radius); box-shadow: 0 8px 24px var(--shadow); }
.toast-error { background: var(--danger); }
.script-error, .script-note { margin-bottom: 1rem; }
.output-value { margin-top: .1rem; }
.output-text { margin: .3rem 0 0; }
.output [data-slot="rows"] { margin-top: .6rem; }
.badge-error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 1rem; }
.form-row > div[hidden] { display: none; }
.check-cell { display: flex !important; flex-direction: row !important; align-items: center; gap: .45rem; padding-top: 1.6rem; }
.check-cell label { margin: 0 !important; }
.hidden-field { display: none; }
.script-form textarea.code { min-height: 22rem; tab-size: 4; }
.reference pre { font-size: .78rem; max-height: none; white-space: pre-wrap; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.segmented a { padding: .4rem .9rem; color: var(--ink); background: var(--surface); }
.segmented a.current { background: var(--accent); color: var(--accent-ink); }
.segmented a:hover { text-decoration: none; }
.spaced-top { margin-top: .9rem; }
.runs td { vertical-align: top; }
ul.plain { margin: 0; padding-left: 1.1rem; }
ul.plain li { margin-bottom: .4rem; }
.prop-help { display: block; margin-top: .2rem; }
.dblock-type .key { margin-left: auto; font-size: .7rem; padding: 0 .3rem; }
.dblock-refresh { font-size: .7rem; color: var(--accent-strong); }

.test-result pre.json { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; }

/* ---------- Übergänge zwischen Seiten ----------
   Browser mit View Transitions (Chrome, Edge, Safari) blenden beim Seitenwechsel über:
   Kopfzeile bleibt stehen, die Markierung des aktiven Reiters wandert zum neuen Reiter,
   der Inhalt gleitet in Leserichtung herein. Andere Browser wechseln ohne Animation. */
@view-transition { navigation: auto; }
.topbar { view-transition-name: kopfzeile; }
.tab-indicator { view-transition-name: reiter; }
main.container, main.designer, main.help-page { view-transition-name: inhalt; }
.designer-bar { view-transition-name: designer-leiste; }

::view-transition-group(*) { animation-duration: 260ms; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; }
::view-transition-old(inhalt) { animation: vt-raus 140ms ease-in both; }
::view-transition-new(inhalt) { animation: vt-rein 260ms cubic-bezier(.2, .8, .2, 1) 60ms both; }
html:active-view-transition-type(forward)::view-transition-new(inhalt) { animation-name: vt-rein-rechts; }
html:active-view-transition-type(forward)::view-transition-old(inhalt) { animation-name: vt-raus-links; }
html:active-view-transition-type(backward)::view-transition-new(inhalt) { animation-name: vt-rein-links; }
html:active-view-transition-type(backward)::view-transition-old(inhalt) { animation-name: vt-raus-rechts; }
/* Kopfzeile: nur die Inhalte wechseln, die Leiste selbst bewegt sich nicht. */
::view-transition-old(kopfzeile), ::view-transition-new(kopfzeile) { animation-duration: 120ms; }

@keyframes vt-raus { to { opacity: 0; } }
@keyframes vt-rein { from { opacity: 0; transform: translateY(8px); } }
@keyframes vt-raus-links { to { opacity: 0; transform: translateX(-24px); } }
@keyframes vt-raus-rechts { to { opacity: 0; transform: translateX(24px); } }
@keyframes vt-rein-rechts { from { opacity: 0; transform: translateX(32px); } }
@keyframes vt-rein-links { from { opacity: 0; transform: translateX(-32px); } }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ---------- Profil ---------- */
.profile-link { display: flex; align-items: center; gap: .6rem; color: inherit; }
.profile-link:hover { text-decoration: none; }
.profile-link:hover .user-name { color: var(--ink); }
.profile-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.4rem; }
.profile-head h1 { margin: 0; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.4rem; }
.facts { margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-top: 1px solid var(--line); }
.facts div:first-child { border-top: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.tag-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .45rem 0; }
.mini-tiles { display: flex; flex-wrap: wrap; gap: .5rem; }
.mini-tile { border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .7rem; color: var(--ink); background: var(--surface); }
.mini-tile:hover { border-color: var(--accent); text-decoration: none; }
.failure-list { list-style: none; margin: 0; padding: 0; }
.failure-list li { padding: .45rem 0; border-top: 1px solid var(--line); }
.failure-text { display: block; color: var(--danger); font-size: .86rem; overflow-wrap: anywhere; }

/* ---------- API-Dokumentation ---------- */
.steps { margin: 0; padding-left: 1.2rem; }
.steps li { margin-bottom: .6rem; }
.steps pre.json { margin-top: .35rem; }
.endpoint-table td { vertical-align: middle; }
.endpoint-group th { padding-top: 1rem; color: var(--ink); font-size: .9rem; }
.endpoint-table tr.endpoint-group:first-child th { padding-top: .2rem; }
.method { display: inline-block; min-width: 4.4em; text-align: center; font-size: .74rem; font-weight: 700; letter-spacing: .02em; border-radius: 4px; padding: .12rem .3rem; color: #fff; }
.method-get { background: #2f6fb3; } .method-post { background: #2e7d4f; } .method-put { background: #a8650f; }
.method-patch { background: #6b5aa6; } .method-delete { background: var(--danger); }
.swagger-card { margin-top: 1.1rem; }
.swagger-frame { display: block; width: 100%; height: 70vh; border: 0; }

/* ---------- Hilfe ---------- */
main.help-page { display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: start; min-height: calc(100vh - var(--topbar-h)); }
.help-toc { position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow: auto; font-size: .86rem; padding: 1.5rem 1rem 2rem 1.25rem; background: var(--surface); border-right: 1px solid var(--line); box-sizing: border-box; }
.help-toc-title { font-size: .78rem; color: var(--muted); margin: 0 0 .8rem; font-weight: 600; list-style: none; }
.help-toc-title::-webkit-details-marker { display: none; }
@media (min-width: 901px) { .help-toc summary { pointer-events: none; } }
.help-toc ul { list-style: none; margin: 0; padding: 0; }
.help-toc > ul > li { margin-bottom: .45rem; }
.help-toc > ul > li > a { font-weight: 600; color: var(--ink); }
.help-toc ul ul { margin: .2rem 0 0 .2rem; border-left: 1px solid var(--line); padding-left: .7rem; }
.help-toc ul ul a { color: var(--muted); display: block; padding: .08rem 0; }
.help-toc a:hover { color: var(--accent-strong); }
.help-toc a.current { color: var(--accent-strong); font-weight: 600; }
.help-main { padding: 1.8rem 2rem 4rem; max-width: 980px; margin: 0 auto; width: 100%; box-sizing: border-box; }
.help-body { padding: 1.5rem 2rem; line-height: 1.65; }
.help-body h2 { margin: 2.2rem 0 .8rem; padding-top: 1rem; border-top: 1px solid var(--line); scroll-margin-top: 74px; }
.help-body h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.help-body h3 { margin: 1.6rem 0 .5rem; scroll-margin-top: 74px; }
.help-body h4 { scroll-margin-top: 74px; }
.help-body p, .help-body li { max-width: 75ch; }
.help-body hr { display: none; }
.help-body table { border-collapse: collapse; margin: .8rem 0 1.1rem; font-size: .9rem; }
.help-body th, .help-body td, .help-body tr:last-child td { border: 1px solid var(--line); padding: .35rem .65rem; text-align: left; vertical-align: top; }
.help-body th { background: var(--surface-2); }
.help-body code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .84em; background: var(--surface-2); border-radius: 4px; padding: .05rem .3rem; }
.help-body pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; overflow: auto; font-size: .84rem; line-height: 1.5; }
.help-body pre code { background: none; padding: 0; }
@media (max-width: 900px) {
  main.help-page { grid-template-columns: minmax(0, 1fr); }
  .help-toc { position: static; height: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); padding: .25rem 1rem; }
  .help-toc summary { cursor: pointer; padding: .75rem 0; font-weight: 600; color: var(--ink); font-size: .95rem; list-style: none; display: flex; justify-content: space-between; }
  .help-toc summary::after { content: "▾"; color: var(--muted); }
  .help-toc details[open] summary::after { content: "▴"; }
  .help-toc details[open] > ul { padding-bottom: 1rem; }
  .help-body table { display: block; overflow-x: auto; }
  .help-main { padding: 1.2rem 1rem 3rem; }
  .help-body { padding: 1.1rem; }
}
.api-docs-side code, .api-docs-side pre { overflow-wrap: anywhere; white-space: pre-wrap; }

/* ---------- Hell/Dunkel ---------- */
.theme-toggle { display: grid; place-items: center; padding: 0; }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .i-sun, .theme-toggle .i-moon, .theme-toggle .i-auto { display: none; }
html[data-theme="light"] .theme-toggle .i-sun,
html[data-theme="dark"] .theme-toggle .i-moon,
html:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .i-auto { display: block; }
.segmented button { font: inherit; font-size: .85rem; border: 0; background: var(--surface); color: var(--ink); padding: .3rem .6rem; cursor: pointer; }
.segmented button.current { background: var(--accent); color: var(--accent-ink); }
.segmented button:hover:not(.current) { color: var(--ink); }

/* ---------- Nachladende Bausteine ---------- */
.skeleton { display: grid; gap: .55rem; margin-top: .6rem; }
.skeleton span { display: block; height: .8rem; border-radius: 4px; background: var(--line); opacity: .7; }
.skeleton span:nth-child(2) { width: 85%; }
.skeleton span:nth-child(3) { width: 60%; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton span { animation: skeleton-puls 1.4s ease-in-out infinite; }
  @keyframes skeleton-puls { 50% { opacity: .45; } }
}

/* ---------- Handy ---------- */
@media (max-width: 640px) {
  .container { padding: 1.1rem .9rem 3rem; }
  .card { padding: .95rem 1rem; }
  h1 { font-size: 1.6rem; }
  .page-head, .head-row { margin-bottom: 1rem; }
  /* Tabellen ohne eigenen Rahmen scrollen seitlich statt die Seite zu verbreitern */
  main table:not(.stack) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Listen werden zu Karten: jede Zeile ein Kasten, jede Zelle mit ihrer Spaltenüberschrift */
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack tr { border: 1px solid var(--line); border-radius: var(--radius); padding: .35rem .75rem; margin-bottom: .6rem; background: var(--surface); }
  table.stack td { display: grid; grid-template-columns: minmax(6.5rem, 38%) 1fr; gap: .75rem; padding: .4rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: .82rem; font-weight: 600; }
  table.stack td.row-actions { display: flex; gap: 1.25rem; border-bottom: 0; padding-top: .6rem; }
  table.stack td.row-actions::before { content: none; }
  .table-wrap:has(table.stack) { overflow: visible; }
  .card-head { flex-wrap: wrap; }
  .card-tools { width: 100%; flex-wrap: wrap; }
  .card-tools .search { flex: 1 1 100%; }
  .card-tools .search input { flex: 1; min-width: 0; }
  /* Fingerfreundliche Ziele */
  .btn { padding: .6rem 1rem; }
  input, select, textarea { font-size: 16px; }  /* verhindert das Hineinzoomen auf iOS */
}

/* ---------- Automatisierungen ---------- */
@media (min-width: 800px) {
  .col-5 { grid-column: span 5; } .col-7 { grid-column: span 7; }
}
.block { display: block; }
.badge-auto { background: var(--accent-soft, var(--surface-2)); color: var(--accent); border-color: transparent; }
.badge.state-running, .badge.state-run-running { background: var(--accent-soft, var(--surface-2)); color: var(--accent); border-color: transparent; }
.badge.state-running::before, .badge.state-run-running::before {
  content: ""; display: inline-block; width: .5em; height: .5em; border-radius: 50%; background: currentColor;
  margin-right: .35em; vertical-align: .08em; animation: state-pulse 1.4s ease-in-out infinite;
}
@keyframes state-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .badge.state-running::before, .badge.state-run-running::before { animation: none; } }
.badge.state-requested { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.state-error, .badge.state-run-error, .badge.state-run-aborted { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.state-run-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.state-run-skipped, .badge.state-run-stopped, .badge.state-off { color: var(--muted); }
.automation-table td { vertical-align: top; }
.automation-table .row-actions form { display: inline; }
.live-run pre.live-log { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 440px; min-height: 4rem; }
.head-row .actions form { display: inline; }

/* data-show-trigger blendet per hidden aus; Zellen mit eigenem display brauchen das ausdrücklich */
.form-row > [hidden], .form-row > .check-cell[hidden] { display: none !important; }

/* ---------- Designer-Startseite: kompakt, Apps und Automatisierungen untereinander ---------- */
.designer-head { margin-bottom: 1rem; align-items: center; }
.head-tools { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.stat-chips { display: flex; gap: .4rem; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.stat-chips li { font-size: .82rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .65rem; }
.stat-chips strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-chips .chip-running { color: var(--accent); border-color: transparent; background: var(--accent-soft, var(--surface-2)); }
.stat-chips .chip-running strong { color: var(--accent); }
.stat-chips .chip-error { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
.stat-chips .chip-error strong { color: var(--danger); }
.card-head h3 { margin: 0; }
.compact-table th, .compact-table td { padding: .42rem .6rem; }
.compact-table td { vertical-align: middle; }
.compact-table tbody tr:last-child td { border-bottom: 0; }
.compact-table .row-actions form { display: inline; }
.automation-overview .state-cell .badge + .badge { margin-left: .25rem; }
.compact-invite { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .8rem; padding: .8rem 1rem; }
.compact-invite > div { flex: 1 1 13rem; }
.compact-invite form { flex-shrink: 0; }
.create-card h3 { margin-bottom: .6rem; }
.create-card .tabs { display: flex; width: 100%; margin-bottom: .7rem; }
.create-card .tabs a { flex: 1 1 auto; text-align: center; padding: .35rem .45rem; font-size: .85rem; white-space: nowrap; }
.create-card .tab-panel > p { margin-top: 0; }
.new-app-form .name-icon { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem; gap: .6rem; }
.new-app-form .icon-field input { text-align: center; }
.ai-hint { margin: .8rem 0 0; padding-top: .6rem; border-top: 1px solid var(--line); }
.setup-examples summary { cursor: pointer; margin: .6rem 0 .3rem; }

/* ---------- Änderungsprotokoll ---------- */
.audit-filter { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .8rem; }
.audit-filter input[type=search] { flex: 1 1 14rem; min-width: 0; }
.audit-table td { vertical-align: top; }
.audit-table .badge { margin: .15rem .3rem 0 0; }
.audit-change { overflow-wrap: anywhere; max-width: 32rem; }
.nowrap { white-space: nowrap; }
.badge.action-create { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.action-delete { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.via-ki, .badge.via-automation, .badge.via-script { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.audit-recent li { margin-bottom: .3rem; }
.record-history { margin-top: 1rem; }

/* ---------- Über den Baukasten, Fuß ---------- */
.site-footer { text-align: center; padding: 1.5rem 1rem 2rem; font-size: .82rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.news-dot { display: none; width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent); margin-left: .35rem; vertical-align: .1em; }
.has-news .news-dot { display: inline-block; }
.has-news { color: var(--accent) !important; font-weight: 600; }
.version-badge { display: flex; flex-direction: column; align-items: flex-end; }
.version-badge strong { font-size: 1.6rem; color: var(--accent); line-height: 1.1; }
.release { padding: .9rem 0; border-top: 1px solid var(--line); }
.release:first-of-type { border-top: 0; padding-top: 0; }
.release header { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; margin-bottom: .4rem; }
.release-body h3 { font-size: .95rem; margin: .7rem 0 .3rem; }
.release-body ul { margin: .2rem 0 .5rem; padding-left: 1.2rem; }
.release-body p { margin: .3rem 0; }
.release-draft { opacity: .75; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; margin: 0; font-size: .9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- Als App installieren ---------- */
.site-footer .install-app { margin-left: .8rem; font-size: inherit; color: var(--muted); }
.site-footer .install-app:hover { color: var(--accent); }
.install-help { max-width: 26rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); padding: 1.1rem 1.25rem; }
.install-help::backdrop { background: rgba(0, 0, 0, .45); }
.install-help h3 { margin-top: 0; }
.offline-page { max-width: 32rem; margin: 18vh auto 0; text-align: center; }
/* Fehlerseite 403 (templates/403.html) */
.error-page { max-width: 34rem; margin: 10vh auto 0; text-align: center; }
.error-code { font-size: 3rem; font-weight: 700; color: var(--muted); margin: 0; letter-spacing: .05em; }
.error-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
/* Als installierte App: Platz für eine Statusleiste, die über der Seite liegt (iPhone mit Notch).
   Nur der tatsächliche Abstand (safe-area-inset-top, sonst 0) und die Kopfzeile wird um genau so
   viel höher. Ein fester Mindestabstand schob unter Windows und Android den Inhalt der 58 px hohen
   Kopfzeile nach unten. */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top, 0px); height: calc(58px + env(safe-area-inset-top, 0px)); }
}
@media (display-mode: standalone) and (max-width: 860px) {
  .topbar { height: auto; min-height: calc(52px + env(safe-area-inset-top, 0px)); }
}

/* Wer weniger Bewegung möchte (Systemeinstellung), bekommt das Menü ohne Animation */
@media (prefers-reduced-motion: reduce) {
  .menu-toggle svg, .topbar-right, .topbar-right > * { transition: none !important; }
}

/* ---------- Dialog (modal.js) ---------- */
.bk-modal { width: min(30rem, calc(100vw - 2rem)); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); padding: 1.15rem 1.3rem 1rem; box-shadow: 0 18px 50px var(--shadow); }
.bk-modal::backdrop { background: rgba(10, 16, 24, .5); }
.bk-modal-warning { border-top-color: var(--c2); }
.bk-modal-danger { border-top-color: var(--danger); }
.bk-modal-success { border-top-color: var(--ok); }
.bk-modal-head { display: flex; align-items: center; gap: .65rem; }
.bk-modal-icon { flex: none; display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.bk-modal-warning .bk-modal-icon { background: var(--warn-soft); color: var(--warn); }
.bk-modal-danger .bk-modal-icon { background: var(--danger-soft); color: var(--danger); }
.bk-modal-success .bk-modal-icon { background: var(--ok-soft); color: var(--ok); }
.bk-modal-title { margin: 0; font-size: 1.15rem; }
.bk-modal-text, .bk-modal-question { margin: .8rem 0 0; }
.bk-modal-question { font-weight: 600; }
.bk-modal-items { margin: .8rem 0 0; padding-left: 1.1rem; display: grid; gap: .35rem; }
.bk-modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.2rem; flex-wrap: wrap; }
@media (prefers-reduced-motion: no-preference) {
  .bk-modal[open] { animation: bk-modal-in .16s ease-out; }
  @keyframes bk-modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
}

/* ---------- Planung: Einsatzplanung, Wochenübersicht, Kanban ---------- */
.plan { --state-empty: var(--danger); --state-open: var(--c2); --state-full: var(--ok); --state-over: var(--danger); }
.plan.is-busy { cursor: progress; }
.plan.is-busy .plan-board, .plan.is-busy .kanban-columns { opacity: .6; pointer-events: none; transition: opacity .15s; }
.plan-nav { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.plan-nav input[type="date"] { width: auto; padding: .28rem .5rem; }
.plan-day-label { margin: .15rem 0 0; }
.plan-summary { margin-bottom: .9rem; }
.plan-summary .chip-open { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.plan-summary .chip-open strong { color: var(--warn); }

.plan-board { display: grid; grid-template-columns: minmax(13rem, 17rem) 1fr; gap: 1rem; align-items: start; }
.plan-pool { position: sticky; top: .75rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; max-height: 75vh; overflow: auto; }
.plan-pool.is-drop-target { outline: 2px dashed var(--muted); outline-offset: -4px; }
.plan-pool.is-drop-over { outline-color: var(--danger); background: var(--danger-soft); }
.plan-pool-head { display: grid; gap: .45rem; margin-bottom: .6rem; }
.plan-filter { padding: .35rem .55rem; }
.plan-hint { margin: .7rem 0 0; }

.plan-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.plan-chip { display: flex; align-items: center; gap: .45rem; padding: .38rem .55rem; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); font-size: .9rem; line-height: 1.25; user-select: none; }
.plan-chip[hidden] { display: none; }
.plan-chip[draggable="true"] { cursor: grab; }
.plan-chip[draggable="true"]:hover { border-color: var(--accent); }
.plan-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.plan-chip.is-planned { border-left-color: var(--line); }
.plan-chip.is-planned .plan-chip-name { color: var(--muted); }
.plan-chip.is-drag-source { opacity: .4; }
.plan-chip.is-picked { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.plan-chip-name { font-weight: 600; overflow-wrap: anywhere; margin-right: auto; }
.plan-chip-info { color: var(--muted); font-size: .8rem; text-align: right; }
.plan-chip-count { flex: none; min-width: 1.35rem; padding: 0 .35rem; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: .75rem; font-weight: 700; text-align: center; }
.plan-remove { border: 0; background: none; color: var(--muted); font: inherit; font-size: 1.1rem; line-height: 1; padding: 0 .2rem; cursor: pointer; border-radius: 4px; }
.plan-remove:hover, .plan-remove:focus-visible { color: var(--danger); background: var(--danger-soft); }

.plan-groups { display: grid; gap: 1rem; min-width: 0; }
.plan-group-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.plan-group-head h4 { margin: 0; font-size: 1.02rem; }
.plan-group-fill { margin-left: auto; font-variant-numeric: tabular-nums; }
.plan-over-note { color: var(--danger); font-weight: 600; }
.plan-prio { display: inline-block; padding: .05rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.plan-prio.prio-1 { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.plan-prio.prio-2 { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.plan-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: .65rem; }
.plan-slot { display: flex; flex-direction: column; gap: .45rem; min-height: 7.5rem; padding: .65rem; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--state-open); border-radius: var(--radius); transition: border-color .12s, background .12s, box-shadow .12s; }
.plan-slot.state-empty { border-top-color: var(--state-empty); }
.plan-slot.state-full { border-top-color: var(--state-full); }
.plan-slot.state-over { border-top-color: var(--state-over); background: var(--danger-soft); }
.plan-slot.state-none { border-top-color: var(--line); }
.plan-slot-head { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.plan-slot-count { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); white-space: nowrap; }
.plan-slot.state-over .plan-slot-count { color: var(--danger); }
.plan-slot.state-full .plan-slot-count { color: var(--ok); }
.plan-meter { display: block; height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.plan-meter > span { display: block; height: 100%; background: var(--state-open); border-radius: inherit; }
.state-full .plan-meter > span { background: var(--state-full); }
.state-over .plan-meter > span { background: var(--state-over); }
.plan-empty { margin: auto 0 0; text-align: center; padding: .4rem; border: 1px dashed var(--line); border-radius: var(--radius); }
.plan-place { align-self: stretch; }
.is-dragging .plan-slot.is-drop-target, .is-dragging .kanban-column.is-drop-target { border-style: dashed; border-color: var(--accent); }
.plan-slot.is-drop-over, .kanban-column.is-drop-over { background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent); }
.plan-slot.is-drop-over.state-full, .plan-slot.is-drop-over.state-over { background: var(--warn-soft); box-shadow: 0 0 0 2px var(--c2); }

@media (max-width: 760px) {
  .plan-board { grid-template-columns: 1fr; }
  .plan-pool { position: static; max-height: 16rem; }
  .plan-pool .plan-chips { flex-direction: row; flex-wrap: wrap; }
}

/* Wochenübersicht */
.plan-grid { font-size: .9rem; font-variant-numeric: tabular-nums; }
.plan-grid th, .plan-grid td { padding: .4rem .5rem; border-bottom: 1px solid var(--line); text-align: center; vertical-align: top; }
.plan-grid thead th { font-weight: 600; white-space: nowrap; }
.plan-grid thead th.is-today { color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.plan-grid thead th.is-weekend { color: var(--muted); }
.plan-grid tbody th[scope="row"], .plan-grid tfoot th { text-align: left; font-weight: 600; white-space: nowrap; }
.plan-grid-group th { text-align: left; background: var(--surface-2); font-weight: 700; padding-top: .55rem; }
.plan-cell a { display: block; color: inherit; border-radius: 6px; padding: .1rem; }
.plan-cell a:hover { text-decoration: none; background: var(--surface); outline: 1px solid var(--line); }
.plan-cell-count { display: block; font-weight: 600; }
.plan-cell-names { display: block; margin-top: .15rem; font-size: .75rem; color: var(--muted); line-height: 1.2; }
.plan-cell.state-empty { background: var(--danger-soft); }
.plan-cell.state-open { background: var(--warn-soft); }
.plan-cell.state-full { background: var(--ok-soft); }
.plan-cell.state-over { background: var(--danger-soft); box-shadow: inset 4px 0 0 var(--danger); }
.plan-cell.state-over .plan-cell-count { color: var(--danger); }
.plan-cell.state-none { color: var(--muted); }
.plan-sum { white-space: nowrap; }
.plan-grid tbody td.plan-sum.state-full { color: var(--ok); }
.plan-grid tbody td.plan-sum.state-over { color: var(--danger); }
.plan-grid tfoot td, .plan-grid tfoot th { border-bottom: 0; border-top: 2px solid var(--line); }
.plan-grid tfoot .plan-meter { margin-top: .3rem; }
.plan-legend { display: flex; gap: 1rem; flex-wrap: wrap; list-style: none; margin: .7rem 0 0; padding: 0; }
.plan-legend li { display: flex; align-items: center; gap: .35rem; }
.plan-legend .state-empty { background: var(--danger-soft); border: 1px solid var(--danger); }
.plan-legend .state-open { background: var(--warn-soft); border: 1px solid var(--c2); }
.plan-legend .state-full { background: var(--ok-soft); border: 1px solid var(--ok); }
.plan-legend .state-over { background: var(--danger); }

/* Kanban */
.kanban-columns { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(14rem, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .3rem; }
.kanban-column { display: flex; flex-direction: column; gap: .5rem; min-height: 10rem; padding: .6rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); }
.kanban-column.is-full { border-top: 3px solid var(--c2); }
.kanban-column.is-over { border-top: 3px solid var(--danger); }
.kanban-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.kanban-head h4 { margin: 0; font-size: .95rem; }
.kanban-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.kanban-card { display: grid; gap: .2rem; padding: .5rem .6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: .92rem; }
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card.is-drag-source { opacity: .4; }
.kanban-card.is-picked { box-shadow: 0 0 0 2px var(--accent); }
.kanban-card a { font-weight: 600; color: var(--ink); }

/* ---------- Schieberegler (Eingabefeld und Baustein „Schieberegler“) ---------- */
input[type="range"] { --fill: 50%; -webkit-appearance: none; appearance: none; width: 100%; height: 1.5rem; padding: 0; border: 0; background: transparent; cursor: pointer; }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 99px; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: linear-gradient(to right, var(--accent) var(--fill), var(--line) var(--fill)); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 1px 3px var(--shadow); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
input[type="range"]:disabled { cursor: default; opacity: .6; }
.range-input { display: flex; align-items: center; gap: .75rem; }
.slider-value { min-width: 3.2rem; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.input-check > div { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: .55rem; }
.input-check input[type="checkbox"] { width: 1.15rem; height: 1.15rem; }

.sliders { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.slider-row { display: grid; grid-template-columns: minmax(7rem, 30%) 1fr auto; align-items: center; gap: .9rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.slider-row:last-child { border-bottom: 0; }
.slider-label { font-weight: 600; overflow-wrap: break-word; hyphens: auto; }
@media (max-width: 560px) { .slider-row { grid-template-columns: 1fr auto; } .slider-row input { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- Checkliste ---------- */
.checklist-meter { margin-bottom: .6rem; }
.checklist-meter > span { background: var(--accent); }
.checklist-meter.is-done > span { background: var(--ok); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist-item label { display: flex; align-items: baseline; gap: .65rem; padding: .45rem .2rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.checklist-item:last-child label { border-bottom: 0; }
.checklist-item input { flex: none; width: 1.1rem; height: 1.1rem; accent-color: var(--accent); transform: translateY(2px); }
.checklist-label { font-weight: 500; }
.checklist-detail { margin-left: auto; text-align: right; }
.checklist-item.is-done .checklist-label { color: var(--muted); text-decoration: line-through; }
.checklist-block.is-busy .checklist { opacity: .6; pointer-events: none; }
.sliders-block.is-busy .sliders { opacity: .6; pointer-events: none; }
.link-add { display: inline-block; margin-top: .6rem; }

/* ---------- Filterleiste ---------- */
.filter-block { padding-bottom: .7rem; }
.filter-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .7rem 1rem; }
.filter-control { display: grid; grid-template-columns: minmax(0, 1fr); gap: .25rem; min-width: 10rem; flex: 1 1 10rem; max-width: 18rem; }
.filter-range { max-width: 22rem; flex-basis: 16rem; }
.filter-label { font-size: .82rem; font-weight: 600; color: var(--muted); }
.filter-pair { display: flex; align-items: center; gap: .35rem; min-width: 0; max-width: 100%; }
.filter-pair input { min-width: 0; flex: 1 1 0; width: 100%; }  /* zwei Datumsfelder passen auch aufs Handy */
.filter-actions { display: flex; gap: .4rem; }
.filter-count { margin: .55rem 0 0; }

/* ---------- Kalender ---------- */
.calendar-wrap { overflow-x: auto; }
.calendar { table-layout: fixed; min-width: 40rem; border-collapse: separate; border-spacing: 0; }
.calendar th { font-size: .8rem; font-weight: 600; color: var(--muted); text-align: left; padding: .3rem .45rem; }
.calendar td { vertical-align: top; height: 6.2rem; padding: .3rem .35rem; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.calendar td:last-child { border-right: 1px solid var(--line); }
.calendar tr:last-child td { border-bottom: 1px solid var(--line); }
.calendar td.is-weekend { background: var(--surface-2); }
.calendar td.is-other { background: var(--surface-2); }
.calendar td.is-other .calendar-num { color: var(--muted); opacity: .6; }
.calendar-day { display: flex; justify-content: space-between; align-items: center; margin-bottom: .2rem; }
.calendar-num { font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 50%; }
.calendar td.is-today .calendar-num { background: var(--accent); color: var(--accent-ink); }
.calendar-add { opacity: 0; font-weight: 700; padding: 0 .35rem; border-radius: 4px; color: var(--accent); }
.calendar td:hover .calendar-add, .calendar-add:focus-visible { opacity: 1; text-decoration: none; background: var(--accent-soft); }
@media (hover: none) { .calendar-add { opacity: .7; } }
.calendar-items { list-style: none; margin: 0; padding: 0; display: grid; gap: .18rem; }
.calendar-item { font-size: .78rem; line-height: 1.25; border-radius: 4px; padding: .1rem .35rem; background: var(--accent-soft); border-left: 3px solid var(--accent); overflow: hidden; }
.calendar-item a, .calendar-item span { display: block; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-item a:hover { text-decoration: underline; }
.calendar-item.tone-2 { border-left-color: var(--c2); background: var(--warn-soft); }
.calendar-item.tone-3 { border-left-color: var(--c3); background: var(--surface-2); }
.calendar-item.tone-4 { border-left-color: var(--c4); background: var(--ok-soft); }
.calendar-item.tone-5 { border-left-color: var(--c5); background: var(--danger-soft); }
.calendar-item.tone-6 { border-left-color: var(--c6); background: var(--surface-2); }
.calendar-more { padding-left: .35rem; }

/* ---------- Aufklappbereich ---------- */
.details-block { padding: 0; }
.details-block summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 1.25rem; font-weight: 600; }
.details-block summary::-webkit-details-marker { display: none; }
.details-block summary::after { content: ""; flex: none; width: .55rem; height: .55rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; margin-right: .2rem; }
.details-block[open] summary::after { transform: rotate(-135deg); }
.details-block summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-lg); }
.details-block .text-block { margin: 0; padding: 0 1.25rem 1rem; }
@media (prefers-reduced-motion: reduce) { .details-block summary::after { transition: none; } }

/* ---------- Kreuztabelle (Pivot) ---------- */
.pivot-table th.num, .pivot-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pivot-table thead th, .pivot-table tfoot th, .pivot-table tfoot td { background: var(--surface-2); font-weight: 600; }
.pivot-table tbody th { font-weight: 600; text-align: left; }
.pivot-total { font-weight: 600; }
.pivot-grand { font-weight: 700; color: var(--accent); }

/* ---------- Zeitstrahl (Gantt) ---------- */
.gantt-wrap { overflow-x: auto; }
.gantt { min-width: 44rem; display: grid; }
.gantt-head, .gantt-row { display: grid; grid-template-columns: minmax(9rem, 14rem) 1fr; align-items: center; border-bottom: 1px solid var(--line); }
.gantt-head { background: var(--surface-2); font-size: .78rem; padding-top: .25rem; padding-bottom: .25rem; }
.gantt-label-col { padding: .35rem .6rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-days { display: grid; grid-template-columns: repeat(28, minmax(1.1rem, 1fr)); text-align: center; }
.gantt-day { position: relative; padding: .2rem 0; font-variant-numeric: tabular-nums; color: var(--muted); }
.gantt-day.is-weekend { background: var(--surface); opacity: .7; }
.gantt-day.is-today { color: var(--accent); font-weight: 700; }
.gantt-date { position: absolute; top: -.15rem; left: 2px; font-size: .65rem; white-space: nowrap; }
.gantt-num { display: block; margin-top: .55rem; font-size: .75rem; }
.gantt-group { padding: .45rem .6rem .25rem; font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.gantt-track { position: relative; height: 2.1rem; }
.gantt-grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(28, 1fr); pointer-events: none; }
.gantt-grid > span { border-left: 1px solid var(--line); }
.gantt-grid > span.is-weekend { background: var(--surface-2); opacity: .55; }
.gantt-grid > span.is-today { background: var(--accent-soft); }
.gantt-bar { position: absolute; top: .32rem; bottom: .32rem; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font-size: .78rem; font-weight: 600; display: flex; align-items: center; padding: 0 .45rem; overflow: hidden; white-space: nowrap; box-shadow: 0 1px 2px var(--shadow); }
.gantt-bar > span { overflow: hidden; text-overflow: ellipsis; }
.gantt-bar.is-clip-left { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.gantt-bar.is-clip-right { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.gantt-bar.tone-2 { background: var(--c2); }
.gantt-bar.tone-3 { background: var(--c3); }
.gantt-bar.tone-4 { background: var(--ok); }
.gantt-bar.tone-5 { background: var(--danger); }
.gantt-bar.tone-6 { background: var(--c6); }
.gantt-empty { padding: 1rem .6rem; margin: 0; }

/* ---------- Detailansicht, Suchbox, Status-Leiste ---------- */
.detail-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.detail-grid { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .8rem 1.25rem; }
.detail-row { display: grid; gap: .15rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.detail-row dt { font-size: .8rem; font-weight: 600; color: var(--muted); }
.detail-row dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Formatierter Text, Berichte-Feed ---------- */
.rich-text { font-weight: 400; line-height: 1.55; overflow-wrap: anywhere; }
.rich-text > :first-child { margin-top: 0; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text p, .rich-text ul, .rich-text ol, .rich-text table, .rich-text pre, .rich-text blockquote { margin: 0 0 .75rem; }
.rich-text h1, .rich-text h2, .rich-text h3, .rich-text h4 { margin: 1rem 0 .5rem; font-size: 1.05rem; }
.rich-text img { max-width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.rich-text table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font-size: .92rem; }
.rich-text th, .rich-text td { border: 1px solid var(--line); padding: .35rem .6rem; text-align: left; vertical-align: top; }
.rich-text th { background: var(--surface-2); font-weight: 600; }
.rich-text table.facts th { width: 1%; white-space: nowrap; }
.rich-text blockquote { border-left: 3px solid var(--accent); padding-left: .8rem; color: var(--muted); }
.rich-text pre, .rich-text code { background: var(--surface-2); border-radius: 4px; font-size: .88em; }
.rich-text pre { padding: .6rem .8rem; overflow-x: auto; }
.rich-text a { color: var(--accent); }
.report-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.report-chip { display: inline-flex; gap: .35rem; align-items: center; padding: .25rem .7rem; border: 1px solid var(--line);
  border-radius: 999px; color: var(--ink); text-decoration: none; font-size: .88rem; background: var(--surface); }
.report-chip span { color: var(--muted); font-size: .8rem; }
.report-chip:hover { border-color: var(--accent); }
.report-chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.report-chip.active span { color: inherit; opacity: .8; }
.report-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.report-item article { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius);
  padding: .9rem 1.1rem; background: var(--surface); }
.report-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.report-source { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; font-size: .8rem;
  padding: .1rem .55rem; border-radius: 999px; }
.report-edit { margin-left: auto; color: var(--muted); }
.report-title { margin: 0 0 .5rem; font-size: 1.05rem; color: var(--ink); }
.report-feed code { overflow-wrap: anywhere; }
textarea.html-source { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .88rem; }

.search-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.search-field { flex: 1 1 16rem; }
.search-field input { width: 100%; }

.stepper { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.stepper-step { flex: 1 1 8rem; min-width: 7rem; }
.stepper-btn { width: 100%; display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--ink); font: inherit; text-align: left; }
button.stepper-btn { cursor: pointer; }
button.stepper-btn:hover { border-color: var(--accent); }
.stepper-num { flex: none; width: 1.45rem; height: 1.45rem; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; font-weight: 700; background: var(--surface); border: 1px solid var(--line); }
.stepper-label { font-weight: 600; font-size: .9rem; overflow-wrap: anywhere; }
.stepper-step.is-done .stepper-btn { background: var(--ok-soft); border-color: var(--ok); }
.stepper-step.is-done .stepper-num { background: var(--ok); border-color: var(--ok); color: #fff; }
.stepper-step.is-current .stepper-btn { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.stepper-step.is-current .stepper-num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper-block.is-busy .stepper { opacity: .6; pointer-events: none; }

/* ---------- Histogramm & Drift ---------- */
.histogram-legend { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; margin-bottom: .65rem; font-size: .82rem; }
.histogram-swatch { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; background: var(--accent); margin-right: .3rem; vertical-align: middle; }
.histogram-swatch-b { background: var(--c2, #d97706); }
.histogram-track { display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.histogram-fill-b { background: var(--c2, #d97706); opacity: .85; }
.version-diff { margin-top: .3rem; }
.version-diff summary { cursor: pointer; color: var(--accent-strong); font-weight: 500; }
.version-diff ul { margin: .25rem 0 0 1rem; padding: 0; }

/* ---------- Ladebalken und Wartezustand (progress.js) ---------- */
.bk-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 1000; pointer-events: none; opacity: 0; transition: opacity .2s ease; }
.bk-progress.is-active { opacity: 1; }
.bk-progress span { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); transition: transform .25s ease; box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.is-loading, button.is-loading { position: relative; cursor: progress; color: transparent !important; }
.btn.is-loading > *, button.is-loading > * { visibility: hidden; }
.btn.is-loading::after, button.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 1em; height: 1em; border-radius: 50%; border: 2px solid var(--accent-ink); border-right-color: transparent; animation: bk-spin .7s linear infinite; }
.btn-secondary.is-loading::after, .link.is-loading::after { border-color: var(--ink); border-right-color: transparent; }
.btn.is-loading:disabled { opacity: 1; }
.busy-note { margin-left: .5rem; font-size: .86rem; color: var(--muted); white-space: nowrap; }
@keyframes bk-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .bk-progress span { transition: none; }
  .btn.is-loading::after, button.is-loading::after { animation-duration: 2.4s; }
}

/* ---------- Startbildschirm der installierten App (splash.js) ---------- */
.bk-splash { display: none; }
.bk-splash-on .bk-splash { display: grid; place-items: center; position: fixed; inset: 0; z-index: 2000; background: var(--bg); transition: opacity .4s ease; }
.bk-splash-on body { overflow: hidden; }
.bk-splash-out .bk-splash { opacity: 0; pointer-events: none; }
.bk-splash-inner { display: grid; justify-items: center; gap: .55rem; padding: 1rem; text-align: center; }
.bk-splash-mark .s1 { fill: var(--accent); }
.bk-splash-mark .s2, .bk-splash-mark .s3 { fill: #7fb9bf; }
.bk-splash-mark .s4 { fill: #d98a1f; }
.bk-splash-name { font-size: 1.9rem; font-weight: 700; color: var(--ink); letter-spacing: -.01em; margin-top: .4rem; }
.bk-splash-claim { color: var(--muted); font-size: .95rem; max-width: 22rem; }
@media (prefers-reduced-motion: no-preference) {
  .bk-splash-mark rect { transform-box: fill-box; transform-origin: center; animation: bk-splash-block .42s cubic-bezier(.34, 1.56, .64, 1) both; }
  .bk-splash-mark .s2 { animation-delay: .09s; }
  .bk-splash-mark .s3 { animation-delay: .18s; }
  .bk-splash-mark .s4 { animation-delay: .3s; }
  .bk-splash-name, .bk-splash-claim { animation: bk-splash-text .45s ease-out .38s both; }
  .bk-splash-claim { animation-delay: .5s; }
  @keyframes bk-splash-block { from { opacity: 0; transform: translateY(-10px) scale(.4); } }
  @keyframes bk-splash-text { from { opacity: 0; transform: translateY(6px); } }
}
