/* KI-Studio Werkbank · Portal
   Arbeitsoberfläche zuerst: ruhige Neutraltöne, eine dunkle Primärfarbe, Blau nur für Fokus und Links,
   Farbe sonst nur für Status. Die Marke steckt im Logo und in der Primärfarbe (Schwarzviolett). */
@font-face {
  font-family: 'Google Sans Flex';
  src: url(/assets/fonts/google-sans-flex-latin.woff2) format('woff2');
  font-weight: 400 700;
  font-stretch: 100% 125%;
  font-display: swap;
}

:root {
  --canvas: #f6f6f5; --surface: #ffffff; --surface-2: #fafaf9; --hover: rgba(28, 22, 26, .05); --active: rgba(28, 22, 26, .085);
  --border: #e5e3e1; --border-strong: #d3d0cd;
  --fg: #1c1a1d; --fg-2: #57535a; --fg-3: #77727a;
  --primary: #221a20; --primary-hover: #3b3039; --on-primary: #ffffff;
  --link: #1d5bd6; --focus: rgba(29, 91, 214, .32);
  --ok: #157a43; --ok-bg: #e7f4eb; --warn: #92570a; --warn-bg: #fcf1dc; --crit: #b42318; --crit-bg: #fdeceb; --info: #1d5bd6; --info-bg: #e9f0fc;
  --scrim: rgba(20, 16, 19, .45);
  --shadow-sm: 0 1px 2px rgba(20, 16, 19, .05);
  --shadow-md: 0 1px 3px rgba(20, 16, 19, .06), 0 6px 18px rgba(20, 16, 19, .07);
  --shadow-lg: 0 2px 6px rgba(20, 16, 19, .08), 0 24px 64px rgba(20, 16, 19, .2);
  --font: 'Google Sans Flex', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --r-sm: 6px; --r: 8px; --r-lg: 12px;
  --side-w: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #141215; --surface: #1c1a1e; --surface-2: #211f23; --hover: rgba(255, 255, 255, .05); --active: rgba(255, 255, 255, .09);
    --border: #302d33; --border-strong: #423e45;
    --fg: #f2f1f3; --fg-2: #b6b2b9; --fg-3: #8f8b93;
    --primary: #f2f1f3; --primary-hover: #ffffff; --on-primary: #1c1a1e;
    --link: #82abff; --focus: rgba(130, 171, 255, .4);
    --ok: #5bd18f; --ok-bg: rgba(91, 209, 143, .12); --warn: #f1b85a; --warn-bg: rgba(241, 184, 90, .12); --crit: #ff8577; --crit-bg: rgba(255, 133, 119, .12); --info: #82abff; --info-bg: rgba(130, 171, 255, .12);
    --scrim: rgba(0, 0, 0, .6);
    --shadow-sm: none; --shadow-md: 0 8px 24px rgba(0, 0, 0, .35); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #141215; --surface: #1c1a1e; --surface-2: #211f23; --hover: rgba(255, 255, 255, .05); --active: rgba(255, 255, 255, .09);
  --border: #302d33; --border-strong: #423e45;
  --fg: #f2f1f3; --fg-2: #b6b2b9; --fg-3: #8f8b93;
  --primary: #f2f1f3; --primary-hover: #ffffff; --on-primary: #1c1a1e;
  --link: #82abff; --focus: rgba(130, 171, 255, .4);
  --ok: #5bd18f; --ok-bg: rgba(91, 209, 143, .12); --warn: #f1b85a; --warn-bg: rgba(241, 184, 90, .12); --crit: #ff8577; --crit-bg: rgba(255, 133, 119, .12); --info: #82abff; --info-bg: rgba(130, 171, 255, .12);
  --scrim: rgba(0, 0, 0, .6);
  --shadow-sm: none; --shadow-md: 0 8px 24px rgba(0, 0, 0, .35); --shadow-lg: 0 24px 64px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--fg); font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.005em; text-wrap: balance; }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 15.5px; line-height: 1.3; }
h3 { font-size: 14px; line-height: 1.35; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
::selection { background: var(--focus); }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.ico { flex: none; display: block; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.boot { display: grid; place-items: center; min-height: 100vh; color: var(--fg-3); }

/* ---------- Rahmen ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 4px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 12px 12px; border-right: 1px solid var(--border); background: var(--canvas); overflow: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 10px; color: var(--fg); }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.brand b { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.2; }
.brand small { display: block; font-size: 12px; color: var(--fg-3); line-height: 1.2; }
.side .new { margin: 4px 0 10px; justify-content: center; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r); color: var(--fg-2); font-weight: 500;
}
.nav a:hover { background: var(--hover); color: var(--fg); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--active); color: var(--fg); font-weight: 600; }
.nav a .ico { color: var(--fg-3); }
.nav a[aria-current="page"] .ico { color: var(--fg); }
.nav a .count { margin-left: auto; font-size: 12px; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.nav .label { padding: 16px 10px 4px; font-size: 12px; font-weight: 600; color: var(--fg-3); }
.side .spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 4px; padding-top: 10px; border-top: 1px solid var(--border); }
.me a { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r); flex: 1; min-width: 0; color: var(--fg); }
.me a:hover { background: var(--hover); text-decoration: none; }
.me a[aria-current="page"] { background: var(--active); }
.me img { width: 30px; height: 30px; border-radius: 50%; flex: none; }
.me b { display: block; font-weight: 600; font-size: 13.5px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { display: block; font-size: 12px; color: var(--fg-3); line-height: 1.25; }

.mbar { display: none; }
.scrim { display: none; }

main { min-width: 0; display: flex; flex-direction: column; }
.page { width: 100%; max-width: 1160px; padding: calc(28px + env(safe-area-inset-top, 0px)) clamp(16px, 4vw, 40px) 96px; display: flex; flex-direction: column; gap: 20px; }
.page.narrow { max-width: 760px; }
.phead { display: flex; flex-direction: column; gap: 6px; }
.crumbs { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--fg-3); flex-wrap: wrap; }
.crumbs a { color: var(--fg-2); }
.crumbs .ico { color: var(--fg-3); }
.ptitle { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.ptitle .t { display: flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.ptitle .t > div { min-width: 0; }
.ptitle h1 { overflow-wrap: anywhere; }
.ptitle .acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.phead .desc { color: var(--fg-2); max-width: 75ch; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .mbar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 40; padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    background: var(--canvas); border-bottom: 1px solid var(--border);
  }
  .mbar .brand { padding: 0; }
  .mbar .grow { flex: 1; }
  .side {
    position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); height: auto; align-self: stretch; background: var(--surface);
    transform: translateX(-102%); transition: transform 200ms var(--ease); box-shadow: var(--shadow-lg); border-right: 0;
  }
  .nav-open .side { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 50; background: var(--scrim); }
  .page { padding-top: 20px; }
}

/* ---------- Flächen ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; min-width: 0; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-h { padding: 16px 20px 0; }
.card-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 16px; }
.card-h > h2, .card-h > h3 { margin-right: auto; }
.card-h .sub { flex-basis: 100%; color: var(--fg-2); font-size: 13.5px; max-width: 80ch; }
.card.danger { border-color: color-mix(in srgb, var(--crit) 35%, var(--border)); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.split > * { min-width: 0; }
@media (max-width: 1080px) { .split { grid-template-columns: minmax(0, 1fr); } }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.lg { gap: 20px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.bottom { align-items: flex-end; flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.soft { color: var(--fg-2); }
.muted { color: var(--fg-3); }
.small { font-size: 13.5px; }
.tiny { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.hint { font-size: 13.5px; color: var(--fg-2); max-width: 80ch; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* Hinweisboxen */
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r); background: var(--info-bg); color: var(--fg); font-size: 13.5px; }
.note > .ico { color: var(--info); margin-top: 1px; }
.note.warn { background: var(--warn-bg); } .note.warn > .ico { color: var(--warn); }
.note.crit { background: var(--crit-bg); } .note.crit > .ico { color: var(--crit); }
.note.ok { background: var(--ok-bg); } .note.ok > .ico { color: var(--ok); }
.note b { font-weight: 600; }

/* Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; box-shadow: var(--shadow-sm); }
.stat .l { font-size: 13px; color: var(--fg-2); }
.stat .v { font-size: 20px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .s { font-size: 12.5px; color: var(--fg-3); }

/* Definitionslisten */
.kv { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 10px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--fg-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.kv.stacked { grid-template-columns: 1fr; gap: 2px; }
.kv.stacked dd { margin-bottom: 10px; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }

/* ---------- Tool-Karten ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.searchbox { position: relative; flex: 1 1 260px; max-width: 380px; }
.searchbox .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }
.searchbox .input { padding-left: 34px; }
.searchbox kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
@media (hover: none) { .searchbox kbd { display: none; } }
kbd { font: 500 11.5px var(--font); color: var(--fg-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; background: var(--surface-2); }
.section-h { display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 600; color: var(--fg-2); margin-top: 4px; }
.section-h .muted { font-weight: 400; }

.tools { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 272px), 1fr)); }
.tcard {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 10px;
  min-width: 0; box-shadow: var(--shadow-sm); transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.tcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.tcard:focus-within { border-color: var(--border-strong); }
.tcard .top { display: flex; gap: 12px; align-items: flex-start; }
.tcard h3 { font-size: 14.5px; overflow-wrap: anywhere; padding-right: 28px; }
.tcard h3 a { color: var(--fg); }
.tcard h3 a:hover { text-decoration: none; }
/* Ganze Karte klickbar, ohne verschachtelte Links */
.tcard h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.tcard h3 a:focus-visible { outline: 0; }
.tcard h3 a:focus-visible::after { outline: 2px solid var(--link); outline-offset: 2px; }
.tcard .desc { font-size: 13.5px; color: var(--fg-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; margin-top: 2px; }
.tcard .badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tcard .meta { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--fg-3); min-height: 41px; }
.tcard .meta .manage { margin: -2px -6px -4px auto; position: relative; z-index: 1; }
.tcard .go { position: absolute; top: 16px; right: 16px; color: var(--fg-3); opacity: 0; transition: opacity 140ms var(--ease); }
.tcard:hover .go, .tcard:focus-within .go { opacity: 1; }
.mark {
  width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 650; font-size: 14.5px;
  letter-spacing: .01em; background: #57535a;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mark { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); } }
:root[data-theme="dark"] .mark { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.mark.lg { width: 48px; height: 48px; font-size: 17px; border-radius: 12px; }
.mark.sm { width: 28px; height: 28px; font-size: 11.5px; border-radius: 7px; }

/* ---------- Badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 500; line-height: 1.6;
  background: var(--hover); color: var(--fg-2);
}
.pill .ico { width: 13px; height: 13px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.crit { background: var(--crit-bg); color: var(--crit); }
.pill.accent, .pill.info { background: var(--info-bg); color: var(--info); }
.pill.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- Buttons ----------
   .btn = Hauptaktion (dunkel), .btn.ghost = normale Aktion (umrandet), .btn.subtle = ohne Rahmen, .btn.danger = zerstörend */
.btn {
  border: 1px solid var(--primary); background: var(--primary); color: var(--on-primary); border-radius: var(--r); padding: 0 14px; height: 36px;
  font-weight: 550; font-size: 14px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn .ico { width: 16px; height: 16px; }
.btn.ghost { background: var(--surface); color: var(--fg); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--fg-3); color: var(--fg); }
.btn.subtle { background: transparent; border-color: transparent; color: var(--fg-2); box-shadow: none; }
.btn.subtle:hover { background: var(--hover); color: var(--fg); }
.btn.danger { background: var(--surface); color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, var(--border)); }
.btn.danger:hover { background: var(--crit-bg); border-color: var(--crit); color: var(--crit); }
.btn.danger.solid { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.danger.solid:hover { background: color-mix(in srgb, var(--crit) 88%, #000); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; border-radius: 7px; }
.btn.sm .ico { width: 15px; height: 15px; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 30px; }
.btn.link { background: none; border: 0; color: var(--link); padding: 0; height: auto; font-weight: 500; box-shadow: none; }
.btn.link:hover { text-decoration: underline; text-underline-offset: 2px; color: var(--link); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn.block { width: 100%; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > .lbl { font-size: 13.5px; font-weight: 550; }
.field > .lbl .opt { font-weight: 400; color: var(--fg-3); }
.field > .help { font-size: 12.5px; color: var(--fg-3); line-height: 1.45; }
.input, select.input, textarea.input {
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg); padding: 0 11px; border-radius: var(--r); width: 100%; min-width: 0; height: 36px;
  font-size: 14px; box-shadow: var(--shadow-sm); transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
select.input { padding-right: 28px; }
select.input.auto { width: auto; max-width: 100%; }
select.input.sm { height: 30px; font-size: 13px; width: auto; padding: 0 26px 0 8px; }
textarea.input { height: auto; min-height: 84px; padding: 8px 11px; line-height: 1.5; resize: vertical; }
textarea.code { font-family: var(--mono); font-size: 12.5px; }
.input::placeholder { color: var(--fg-3); opacity: 1; }
.input:hover { border-color: var(--fg-3); }
.input:focus { outline: 0; border-color: var(--link); box-shadow: 0 0 0 3px var(--focus); }
.input:disabled { background: var(--surface-2); color: var(--fg-3); cursor: not-allowed; }
input[type=file].input { height: auto; padding: 6px; }
.affix { display: flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.affix:focus-within { border-color: var(--link); box-shadow: 0 0 0 3px var(--focus); }
.affix .input { border: 0; box-shadow: none; border-radius: 0; }
.affix .input:focus { box-shadow: none; }
.affix span { display: flex; align-items: center; padding: 0 10px; background: var(--surface-2); color: var(--fg-3); font-size: 13px; white-space: nowrap; }
.affix span:first-child { border-right: 1px solid var(--border); }
.affix span:last-child { border-left: 1px solid var(--border); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--primary); width: 16px; height: 16px; flex: none; }
.check b { font-weight: 550; }
.check .help { display: block; font-size: 12.5px; color: var(--fg-3); }

/* Auswahlkarten */
.options { display: grid; gap: 8px; }
.options.cols { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.options label {
  display: flex; gap: 10px; padding: 12px 14px; cursor: pointer; align-items: flex-start; border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); transition: border-color 120ms var(--ease), background-color 120ms var(--ease);
}
.options label:hover { border-color: var(--fg-3); }
.options label:has(input:checked) { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.options input { accent-color: var(--primary); margin: 2px 0 0; flex: none; width: 16px; height: 16px; }
.options .ico { color: var(--fg-2); margin-top: 1px; }
.options b { display: block; font-weight: 550; font-size: 14px; }
.options span { display: block; font-size: 12.5px; color: var(--fg-2); line-height: 1.45; }

/* Segmentierte Auswahl */
.stack > .seg { align-self: flex-start; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--hover); border-radius: 9px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { border: 0; background: transparent; color: var(--fg-2); padding: 0 12px; height: 28px; border-radius: 7px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--fg); font-weight: 600; box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--fg); }

/* Einstellungsreihen: Erklärung links, Bedienung rechts */
.srows { display: flex; flex-direction: column; }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 8px 32px; padding: 16px 0; border-top: 1px solid var(--border); }
.srow:first-child { border-top: 0; padding-top: 0; }
.srow:last-child { padding-bottom: 0; }
.srow > .d b { display: block; font-weight: 550; }
.srow > .d span { display: block; font-size: 13px; color: var(--fg-2); margin-top: 2px; max-width: 52ch; }
.srow > .c { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.srow.inline { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.srow.inline > .c { flex-direction: row; justify-content: flex-end; align-items: center; }
@media (max-width: 720px) { .srow { grid-template-columns: 1fr; } .srow.inline > .c { justify-content: flex-start; } }

/* Speicherleiste, erscheint bei ungespeicherten Änderungen */
.savebar {
  position: sticky; bottom: 16px; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); animation: rise 180ms var(--ease);
}
.savebar .grow { font-size: 13.5px; color: var(--fg-2); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Dropzone ---------- */
.drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); padding: 28px 20px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center;
  background: var(--surface-2); transition: border-color 120ms var(--ease), background-color 120ms var(--ease); cursor: pointer;
}
.drop:hover { border-color: var(--fg-3); }
.drop.over { border-color: var(--link); border-style: solid; background: var(--info-bg); }
.drop .bubble { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--fg-2); box-shadow: var(--shadow-sm); }
.drop b { font-size: 14.5px; font-weight: 600; }
.drop .row { justify-content: center; margin-top: 4px; }
.drop.compact { padding: 16px; flex-direction: row; text-align: left; gap: 12px; }
.drop.compact .row { margin: 0 0 0 auto; }
.picked { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.picked .ico { color: var(--fg-2); }
.files { font-size: 12.5px; text-align: left; width: 100%; max-height: 160px; overflow: auto; margin: 0; padding: 8px 12px 8px 28px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.files li { font-family: var(--mono); font-size: 12px; color: var(--fg-2); }
.progress { height: 6px; border-radius: 999px; overflow: hidden; width: 100%; background: var(--hover); }
.progress i { display: block; height: 100%; background: var(--primary); width: 0; transition: width 120ms linear; border-radius: inherit; }

/* ---------- Tabellen ---------- */
.tblwrap { overflow: auto; }
.card:not(.flush) th { background: none; }
.card:not(.flush) th:first-child, .card:not(.flush) td:first-child { padding-left: 0; }
.card:not(.flush) th:last-child, .card:not(.flush) td:last-child { padding-right: 0; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: 12.5px; font-weight: 550; color: var(--fg-2); white-space: nowrap; background: var(--surface-2); }
tbody tr:hover td { background: color-mix(in srgb, var(--hover) 60%, transparent); }
td.r, th.r { text-align: right; }
td.r .row { justify-content: flex-end; flex-wrap: nowrap; }
td.nowrap { white-space: nowrap; }
.ava { width: 28px; height: 28px; border-radius: 50%; vertical-align: middle; flex: none; }
.ava.lg { width: 44px; height: 44px; }
.who { display: flex; gap: 10px; align-items: center; min-width: 200px; }
.who b { display: block; font-weight: 550; }
.who small { display: block; color: var(--fg-3); font-size: 12.5px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; gap: 4px; }
.tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 10px 10px; font-weight: 500; font-size: 14px; white-space: nowrap;
  color: var(--fg-2); display: inline-flex; gap: 7px; align-items: center;
}
.tabs button .ico { width: 16px; height: 16px; color: var(--fg-3); }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { color: var(--fg); font-weight: 600; border-bottom-color: var(--fg); }
.tabs button[aria-selected="true"] .ico { color: var(--fg); }

/* ---------- Listen ---------- */
.list { display: flex; flex-direction: column; }
.li { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.li:first-child { border-top: 0; padding-top: 0; }
.li:last-child { padding-bottom: 0; }
.li .grow { min-width: 180px; }
.li .lead { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); color: var(--fg-2); flex: none; }
.li .lead img { width: 32px; height: 32px; border-radius: 50%; }
.li b { font-weight: 550; }
.li .sub { display: block; font-size: 12.5px; color: var(--fg-3); }
.empty { padding: 32px 16px; text-align: center; color: var(--fg-2); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty .bubble { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--hover); color: var(--fg-2); margin-bottom: 4px; }
.empty b { color: var(--fg); font-weight: 600; font-size: 14.5px; }
.empty p { max-width: 46ch; font-size: 13.5px; }
.empty .btn { margin-top: 8px; }
.copy { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0; }
.urlbox { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 4px 4px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.urlbox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
pre.snippet { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; overflow: auto; font: 12.5px/1.6 var(--mono); margin: 0; }
details.more > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 550; color: var(--fg-2); }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .ico { transition: transform 140ms var(--ease); }
details.more[open] > summary .ico { transform: rotate(90deg); }
details.more > summary:hover { color: var(--fg); }
details.more > .body { margin-top: 14px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login .box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 20px; }
.login .lcard { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 16px; }
.login .logo { display: flex; align-items: center; gap: 10px; }
.login .logo img { width: 36px; height: 36px; border-radius: 9px; }
.login h1 { font-size: 20px; }
.login .foot { text-align: center; font-size: 12.5px; color: var(--fg-3); }
.gbtn {
  display: flex; gap: 10px; align-items: center; justify-content: center; border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg);
  border-radius: var(--r); height: 42px; font-weight: 550; font-size: 14.5px; box-shadow: var(--shadow-sm);
}
.gbtn:hover { background: var(--surface-2); border-color: var(--fg-3); text-decoration: none; }
.gbtn svg { width: 18px; height: 18px; }

/* ---------- Dialoge, Menüs, Toasts ---------- */
dialog {
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--fg); padding: 0; width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px); box-shadow: var(--shadow-lg);
}
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog[open] { animation: pop 160ms var(--ease); }
@keyframes pop { from { transform: scale(.98); opacity: 0; } }
dialog::backdrop { background: var(--scrim); }
dialog .dh { padding: 18px 20px 4px; display: flex; align-items: center; gap: 12px; }
dialog .dh h2 { margin-right: auto; font-size: 16.5px; }
dialog .db { padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 14px; overflow: auto; max-height: calc(100vh - 200px); }
dialog .df { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 14px 14px; }

.menu-wrap { position: relative; display: inline-flex; }
.menu {
  position: absolute; z-index: 70; top: calc(100% + 4px); right: 0; min-width: 200px; padding: 4px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-md); display: flex; flex-direction: column; animation: pop 120ms var(--ease);
}
.menu button, .menu a {
  display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: 7px; font-size: 13.5px; color: var(--fg); text-align: left;
}
.menu button:hover, .menu a:hover { background: var(--hover); text-decoration: none; }
.menu .ico { width: 16px; height: 16px; color: var(--fg-3); }
.menu .danger, .menu .danger .ico { color: var(--crit); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

#toasts { position: fixed; z-index: 1000; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast {
  display: flex; gap: 10px; align-items: center; background: #1c1a1d; color: #f2f1f3; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; max-width: 460px;
  box-shadow: var(--shadow-lg); animation: rise 180ms var(--ease); pointer-events: auto;
}
.toast .ico { color: #5bd18f; width: 17px; height: 17px; }
.toast.err .ico { color: #ff8577; }
:root[data-theme="dark"] .toast { background: #f2f1f3; color: #1c1a1d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #2a272d; border: 1px solid var(--border-strong); } }

.checklist { display: flex; flex-direction: column; max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r); }
.checklist label { padding: 9px 12px; border-top: 1px solid var(--border); }
.checklist label:first-child { border-top: 0; }
.checklist label:hover { background: var(--hover); }
