/* ==========================================================================
   Orga-Dokumente – Oberfläche
   Neutrale Startseite; sobald eine Organisation gewählt ist, setzen
   CSS-Variablen (aus config/organisationen.json) deren Farben & Schriften.
   ========================================================================== */

:root {
  --brand: #1D1D1F;
  --brand-ink: #FFFFFF;
  --accent: #0A84FF;
  --bg: #F4F3EF;
  --surface: #FFFFFF;
  --text: #1D1D1F;
  --muted: #6E6E73;
  --line: #E4E2DC;
  --soft: #EEEDE8;
  --radius: 14px;
  --btn-radius: 10px;
  --font-head: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  --head-weight: 700;
  --header-bg: rgba(244, 243, 239, .86);
  --header-ink: #1D1D1F;
  --stripe: transparent;
  --stripe-h: 4px;
  --ok: #1E8E5A;
  --warn: #B26A00;
  --danger: #C62828;
  --shadow-sm: 0 1px 2px rgba(20, 20, 30, .06);
  --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 8px 24px -8px rgba(20, 20, 30, .12);
  --shadow-lg: 0 2px 4px rgba(20, 20, 30, .05), 0 24px 48px -16px rgba(20, 20, 30, .22);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Kopfzeile ---------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  height: 68px; padding: 0 24px;
  background: var(--header-bg); color: var(--header-ink);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background-color .35s var(--ease), color .35s var(--ease);
  -webkit-app-region: drag;
}
.topbar > * { -webkit-app-region: no-drag; }
.stripe { height: var(--stripe-h); background: var(--stripe); }
.app-mark { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; }
.app-mark .dot { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: conic-gradient(from 200deg, #CE1127, #FFC000, #6F8D62, #18788F, #173E6A, #9B696B, #CE1127); color: #fff; }
.app-mark .dot .icon { width: 15px; height: 15px; stroke-width: 2.2; }
.spacer { flex: 1; }

.org-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.org-head .logo-img { height: 42px; max-width: 240px; object-fit: contain; display: block; }
.org-head .org-head-name { font-size: 13px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px;
  padding-left: 14px; border-left: 1px solid color-mix(in srgb, var(--header-ink) 25%, transparent); }

.wordmark { font-family: var(--wm-font, var(--font-head)); font-weight: 700; color: var(--wm-color, var(--brand)); letter-spacing: -.01em; white-space: nowrap; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; min-width: 36px; padding: 0 10px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: inherit;
  transition: background-color .15s, border-color .15s;
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 9%, transparent); }
.icon-btn .lbl { font-size: 13.5px; font-weight: 550; }

.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  border-radius: 999px; font-size: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip.warn { border-color: #F1D3A6; background: #FFF6E8; color: var(--warn); }
.chip .icon { width: 15px; height: 15px; }

/* ---------- Buttons ------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: var(--btn-radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14.5px; white-space: nowrap;
  transition: transform .12s var(--ease), background-color .15s, border-color .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--brand) 80%, transparent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.big { height: 52px; padding: 0 28px; font-size: 16px; }
.btn.small { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
[data-org="wot"] .link { color: #0077BF; }

/* ---------- Startseite --------------------------------------------------- */
.home { max-width: 1120px; margin: 0 auto; padding: 48px 32px 64px; }
.home h1 { font-family: var(--font-head); font-size: 38px; line-height: 1.12; letter-spacing: -.025em; margin: 0 0 8px; font-weight: 700; }
.home .lead { font-size: 18px; color: var(--muted); margin: 0 0 32px; }

.setup-banner {
  display: flex; align-items: center; gap: 18px; padding: 18px 20px; margin: 0 0 28px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.setup-banner .badge { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #FFF1DC; color: var(--warn); flex: none; }
.setup-banner .badge .icon { width: 22px; height: 22px; }
.setup-banner h3 { margin: 0; font-size: 16px; }
.setup-banner p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.org-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.org-card {
  position: relative; display: flex; flex-direction: column; text-align: left;
  padding: 0; border-radius: 18px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s;
  animation: rise .5s var(--ease) both; animation-delay: calc(var(--i) * 45ms);
}
.org-card::before { content: ""; height: 5px; background: var(--card-stripe); }
.org-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--card-brand) 55%, var(--line)); }
.org-card:focus-visible { outline: 3px solid color-mix(in srgb, var(--card-brand) 55%, transparent); outline-offset: 2px; }
.org-card .logo-zone { height: 132px; display: grid; place-items: center; padding: 18px 28px; background: var(--card-bg); }
.org-card .logo-zone img { max-height: 76px; max-width: 82%; object-fit: contain; }
.org-card .logo-zone .wordmark { font-size: 30px; }
.org-card .meta { padding: 14px 18px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.org-card .meta .txt { min-width: 0; flex: 1; }
.org-card .meta strong { display: block; font-size: 16px; letter-spacing: -.01em; }
.org-card .meta small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-card .go { width: 34px; height: 34px; border-radius: 999px; display: grid; place-items: center; background: var(--soft); color: var(--muted); transition: all .25s var(--ease); }
.org-card:hover .go { background: var(--card-brand); color: var(--card-ink); transform: translateX(2px); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 99px; margin-right: 6px; vertical-align: 1px; background: #C9C6BE; }
.status-dot.ok { background: var(--ok); }

.recent { margin-top: 44px; }
.section-title { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; }
.recent-list { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.recent-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line); }
.recent-row:first-child { border-top: 0; }
.recent-row .mini { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; color: #fff; font-size: 12px; font-weight: 700; }
.recent-row .mini .icon { width: 18px; height: 18px; }
.recent-row .txt { flex: 1; min-width: 0; }
.recent-row .txt strong { display: block; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-row .txt small { color: var(--muted); font-size: 12.5px; }
.empty-note { padding: 22px; color: var(--muted); font-size: 14px; text-align: center; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Arbeitsbereich ---------------------------------------------- */
.workspace { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 28px; max-width: 1400px; margin: 0 auto; padding: 28px 28px 48px; align-items: start; }
.workspace.no-aside { grid-template-columns: 250px minmax(0, 1fr); }
@media (max-width: 1180px) { .workspace { grid-template-columns: 220px minmax(0, 1fr); } .aside { display: none; } }

/* Schritt-Leiste (wie im Organigramm) */
.rail { position: sticky; top: 100px; }
.rail-list { list-style: none; margin: 0; padding: 0; position: relative; }
.rail-list::before { content: ""; position: absolute; left: 19px; top: 22px; bottom: 22px; width: 2px; background: var(--line); }
.rail-item { position: relative; }
.rail-btn { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px 8px 0; border: 0; background: none; text-align: left; border-radius: 12px; }
.rail-btn[disabled] { cursor: default; }
.rail-num {
  position: relative; z-index: 1; flex: none; width: 40px; height: 40px; border-radius: 999px;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--surface); border: 2px solid var(--line); color: var(--muted);
  transition: all .25s var(--ease);
}
[data-org="kulturbruecke"] .rail-num, [data-org="wot"] .rail-num { border-radius: 0; }
.rail-num .icon { width: 17px; height: 17px; }
.rail-txt { min-width: 0; }
.rail-title { display: block; font-weight: 650; font-size: 14.5px; color: var(--muted); }
.rail-sub { display: block; font-size: 12.5px; color: var(--muted); opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.rail-item.done .rail-num { background: var(--soft); border-color: var(--soft); color: var(--brand); }
[data-org="wot"] .rail-item.done .rail-num { color: #000; }
.rail-item.done .rail-title { color: var(--text); }
.rail-item.current .rail-num { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 0 0 5px color-mix(in srgb, var(--brand) 16%, transparent); }
.rail-item.current .rail-title { color: var(--text); }
.rail-item.locked { opacity: .5; }
.rail-btn:not([disabled]):hover .rail-title { color: var(--brand); }
[data-org="wot"] .rail-btn:not([disabled]):hover .rail-title { color: #0077BF; }
[data-org="kulturbruecke"] .rail-title { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .06em; font-size: 14px; }
[data-org="kulturbruecke"] .rail-item.current .rail-title { color: var(--brand); }

/* Hauptfläche */
.stage {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); min-height: 520px; display: flex; flex-direction: column;
  animation: rise .35s var(--ease) both;
}
.stage-body { padding: 34px 38px 28px; flex: 1; }
.stage-foot { display: flex; align-items: center; gap: 12px; padding: 16px 38px; border-top: 1px solid var(--line); }
.stage-foot .hint { color: var(--muted); font-size: 13px; }
.kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; font-size: 11.5px; font-family: -apple-system, sans-serif; background: var(--bg); }

.eyebrow { font-size: 12.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.stage h2 { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 30px; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 6px; }
.stage .sub { color: var(--muted); font-size: 16px; margin: 0 0 28px; }
[data-org="akademie"] .stage h2 { color: var(--brand); }
[data-org="einfach"] .stage h2 { color: #C9735F; }
[data-org="kulturbruecke"] .stage h2 { letter-spacing: 0; font-size: 31px; }
[data-org="amalun"] .stage h2 .hl { background: linear-gradient(transparent 64%, #FFD666 64%, #FFD666 92%, transparent 92%); padding: 0 2px; }
[data-org="wot"] .stage h2 .hl { background: linear-gradient(transparent 60%, #FFC000 60%); }

/* Dokument-Kacheln */
.doc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1320px) { .doc-grid { grid-template-columns: repeat(2, 1fr); } }
.doc-tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  padding: 18px 18px 16px; text-align: left; border-radius: var(--radius);
  border: 1.5px solid var(--line); background: var(--surface);
  transition: border-color .2s, box-shadow .2s, transform .2s var(--ease), background-color .2s;
}
.doc-tile:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow); }
.doc-tile.selected { border-color: var(--brand); background: color-mix(in srgb, var(--soft) 55%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.doc-tile .ico { width: 46px; height: 46px; border-radius: calc(var(--radius) * .8); display: grid; place-items: center; background: var(--soft); color: var(--brand); }
[data-org="wot"] .doc-tile .ico { color: #000; }
.doc-tile .ico .icon { width: 23px; height: 23px; }
.doc-tile strong { font-size: 16px; display: block; letter-spacing: -.01em; }
.doc-tile small { color: var(--muted); font-size: 13px; }
.doc-tile .st { font-size: 12.5px; display: flex; align-items: center; gap: 6px; color: var(--muted); }
.doc-tile .st.ok { color: var(--ok); }
.doc-tile .st .icon { width: 14px; height: 14px; }
.doc-tile .check { position: absolute; top: 12px; right: 12px; width: 24px; height: 24px; border-radius: 99px; background: var(--brand); color: var(--brand-ink); display: none; place-items: center; }
.doc-tile.selected .check { display: grid; }
.doc-tile .check .icon { width: 14px; height: 14px; stroke-width: 2.6; }

.tpl-panel { margin-top: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); padding: 18px 20px; animation: rise .3s var(--ease) both; }
.tpl-row { display: flex; align-items: center; gap: 14px; }
.tpl-file { width: 42px; height: 50px; border-radius: 6px; background: #2B579A; color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; box-shadow: var(--shadow-sm); }
.tpl-row .txt { flex: 1; min-width: 0; }
.tpl-row .txt strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-row .txt small { color: var(--muted); font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.coverage { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.coverage-head { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; }
.bar { flex: 1; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; max-width: 220px; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.tokens { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.token { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.token.on { background: #E7F5EE; border-color: #BFE3D0; color: #17694A; }
.callout { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius); background: #FFF7EA; border: 1px solid #F1DDBA; color: #6B4A12; }
.callout .icon { width: 20px; height: 20px; margin-top: 2px; }
.callout p { margin: 2px 0 10px; font-size: 14px; }
.callout .row { display: flex; gap: 8px; flex-wrap: wrap; }
select.inp { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23777' fill='none' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

/* Formular */
.form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px 16px; }
.field { display: flex; flex-direction: column; gap: 7px; grid-column: span var(--w, 3); }
.field label { font-size: 13px; font-weight: 600; color: var(--text); display: flex; justify-content: space-between; gap: 8px; }
.field label .opt { color: var(--muted); font-weight: 450; font-size: 12px; }
.inp {
  width: 100%; height: 46px; padding: 0 14px; border-radius: calc(var(--radius) * .7);
  border: 1.5px solid var(--line); background: var(--surface); outline: none; font-size: 15.5px;
  transition: border-color .15s, box-shadow .15s;
}
[data-org="einfach"] .inp, [data-org="amalun"] .inp, [data-org="finu"] .inp { border-radius: 12px; }
textarea.inp { height: auto; min-height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.inp:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
[data-org="wot"] .inp:focus { border-color: #000; box-shadow: 0 0 0 4px rgba(255, 192, 0, .45); }
.inp::placeholder { color: color-mix(in srgb, var(--muted) 65%, transparent); }
.inp-wrap { position: relative; }
.inp-wrap .unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.inp-wrap .inp { padding-right: 34px; }
.field .help { font-size: 12.5px; color: var(--muted); }
.field .help.warn { color: var(--warn); }
.field.auto .inp { background: color-mix(in srgb, var(--soft) 60%, var(--surface)); }
.hidden-note { margin-top: 22px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.hidden-note .icon { width: 15px; height: 15px; }

/* Prüfen & Erstellen */
.review { display: grid; gap: 14px; }
.review-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.review-card header { display: flex; align-items: center; gap: 10px; padding: 11px 16px; background: var(--bg); font-weight: 650; font-size: 14px; }
.review-card header .icon { color: var(--brand); }
[data-org="wot"] .review-card header .icon { color: #000; }
.review-card dl { display: grid; grid-template-columns: 200px 1fr; margin: 0; }
.review-card dt, .review-card dd { padding: 9px 16px; border-top: 1px solid var(--line); margin: 0; font-size: 14px; }
.review-card dt { color: var(--muted); }
.review-card dd { white-space: pre-wrap; word-break: break-word; }
.review-card dd.empty { color: color-mix(in srgb, var(--muted) 70%, transparent); font-style: italic; }
.warnings { display: grid; gap: 6px; margin-bottom: 16px; }
.warnings div { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--warn); }
.warnings .icon { width: 15px; height: 15px; }
.save-box { display: grid; grid-template-columns: 1fr; gap: 14px; margin-top: 18px; padding: 18px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); }
.save-row { display: flex; align-items: center; gap: 12px; }
.save-row .lbl { width: 110px; flex: none; font-size: 13px; font-weight: 600; color: var(--muted); }
.save-row .val { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-row .inp { height: 40px; }

/* Fertig */
.success { text-align: center; padding: 30px 10px 10px; }
.success .ring { width: 92px; height: 92px; margin: 0 auto 22px; border-radius: 999px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--brand) 14%, transparent); animation: pop .5s var(--ease) both; }
[data-org="kulturbruecke"] .success .ring, [data-org="wot"] .success .ring { border-radius: 0; }
.success .ring .icon { width: 44px; height: 44px; stroke-width: 2.4; }
.success h2 { margin-bottom: 8px; }
.success .file { display: inline-flex; align-items: center; gap: 12px; margin: 18px auto 26px; padding: 12px 16px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); text-align: left; max-width: 100%; }
.success .file small { display: block; color: var(--muted); font-size: 12.5px; }
.success .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.success .row + .row { margin-top: 12px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* Übersicht rechts */
.aside { position: sticky; top: 100px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 8px; box-shadow: var(--shadow-sm); }
.aside h4 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.aside .grp { padding: 10px 0; border-top: 1px solid var(--line); }
.aside .grp-t { font-size: 12px; font-weight: 650; color: var(--muted); margin-bottom: 4px; }
.aside .kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 2px 0; }
.aside .kv span:first-child { color: var(--muted); flex: none; }
.aside .kv span:last-child { text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aside .kv .none { color: color-mix(in srgb, var(--muted) 55%, transparent); }

/* Organisation wechseln */
.switcher { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 300px; padding: 6px; z-index: 50;
  background: #fff; color: #1D1D1F; border: 1px solid #E4E2DC; border-radius: 14px; box-shadow: var(--shadow-lg);
  animation: rise .18s var(--ease) both; font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 9px; text-align: left; font-size: 14px; }
.menu button:hover, .menu button.active { background: #F2F1ED; }
.menu .sw { width: 64px; height: 34px; display: grid; place-items: center; flex: none; }
.menu .sw img { max-width: 64px; max-height: 30px; object-fit: contain; }
.menu .sw .wordmark, .org-row .sw .wordmark { font-size: 11.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: block; text-align: center; }

/* Modal (Einstellungen) */
.backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(20, 20, 26, .38); display: grid; place-items: center; padding: 24px; animation: fade .2s both; backdrop-filter: blur(3px); }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: min(760px, 100%); max-height: calc(100vh - 48px); overflow: auto;
  background: #fff; color: #1D1D1F; border-radius: 18px; box-shadow: var(--shadow-lg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif; animation: rise .25s var(--ease) both;
  --brand: #1D1D1F; --brand-ink: #fff; --line: #E4E2DC; --surface: #fff; --bg: #F4F3EF; --text: #1D1D1F; --muted: #6E6E73; --radius: 12px; --btn-radius: 10px;
}
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 20px 24px 8px; }
.sheet-head h3 { margin: 0; font-size: 20px; flex: 1; }
.sheet-body { padding: 8px 24px 24px; }
.set-block { padding: 18px 0; border-top: 1px solid var(--line); }
.set-block:first-child { border-top: 0; }
.set-block h5 { margin: 0 0 4px; font-size: 15px; }
.set-block p.d { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.path-row { display: flex; gap: 8px; }
.path-row .inp { height: 40px; font-size: 14px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.org-rows { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.org-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); }
.org-row:first-child { border-top: 0; }
.org-row .sw { width: 72px; height: 32px; display: grid; place-items: center; flex: none; }
.org-row .sw img { max-width: 72px; max-height: 30px; object-fit: contain; }
.org-row .sw .wordmark { font-size: 13px; }
.org-row .txt { flex: 1; min-width: 0; }
.org-row .txt strong { font-size: 14px; display: block; }
.org-row .txt small { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 11px; font-weight: 650; padding: 2px 7px; border-radius: 99px; background: #EEF6F1; color: #17694A; margin-left: 6px; text-transform: uppercase; letter-spacing: .04em; }
.tag.off { background: #F4F3EF; color: #8A8A8E; }
.tag.man { background: #EAF1FB; color: #2457A6; }

/* Toasts */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; }
.toast { padding: 11px 16px; border-radius: 12px; background: #1D1D1F; color: #fff; font-size: 14px; box-shadow: var(--shadow-lg); animation: rise .25s var(--ease) both; max-width: 560px;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
.toast.err { background: #B3261E; }

.busy { pointer-events: none; opacity: .7; }

/* ==========================================================================
   Version 1.2 – Adressbuch, Archiv, Auswahlfelder, Startseite
   ========================================================================== */
.muted-note { color: var(--muted); font-size: 12.5px; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 7px; margin-left: 8px; border-radius: 99px; background: var(--soft); color: var(--muted); font-size: 11.5px; font-weight: 650; vertical-align: 2px; }
.org-card .meta strong .count { background: color-mix(in srgb, var(--card-brand) 14%, #fff); color: var(--card-brand); }

/* Startseite: zwei Spalten unten */
.home-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; margin-top: 44px; align-items: start; }
.home-cols .recent { margin-top: 0; }
@media (max-width: 1100px) { .home-cols { grid-template-columns: 1fr; } }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-head .section-title { margin: 0; }
.link { color: var(--brand); }
.home .link { color: #1D1D1F; }
.quick { display: grid; gap: 10px; }
.quick .section-title { margin-bottom: 2px; }
.quick-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); text-align: left; transition: transform .2s var(--ease), box-shadow .2s; }
.quick-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.quick-card .qi { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: #EEEDE8; flex: none; }
.quick-card .qi .icon { width: 21px; height: 21px; }
.quick-card strong { display: block; font-size: 15px; }
.quick-card small { color: var(--muted); font-size: 12.5px; line-height: 1.35; display: block; }
.recent-row .btn.small { height: 32px; }

/* Auswahl (Herr / Frau / Divers) */
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: calc(var(--radius) * .7 + 3px); background: var(--bg); border: 1px solid var(--line); width: max-content; max-width: 100%; }
.seg-btn { border: 0; background: transparent; padding: 8px 18px; border-radius: calc(var(--radius) * .7); font-weight: 600; font-size: 14.5px; color: var(--muted); transition: all .15s; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--brand); color: var(--brand-ink); box-shadow: var(--shadow-sm); }
.sheet .seg-btn.on { background: #1D1D1F; color: #fff; }

/* Adressbuch-Suche in der Maske */
.ab-picker { position: relative; margin: -6px 0 24px; }
.ab-search { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 14px; border-radius: calc(var(--radius) * .7 + 2px); border: 1.5px dashed color-mix(in srgb, var(--brand) 35%, var(--line)); background: color-mix(in srgb, var(--soft) 45%, var(--surface)); }
.ab-search > .icon { color: var(--muted); }
.ab-input { flex: 1; min-width: 0; height: 42px; border: 0; outline: none; background: transparent; font-size: 15px; }
.ab-linked { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ok); white-space: nowrap; }
.ab-linked .icon { width: 14px; height: 14px; }
.ab-results { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.ab-results:empty { display: none; }
.ab-hint { padding: 10px 14px 6px; font-size: 12.5px; color: var(--muted); }
.ab-row, .book-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 14px; border: 0; background: none; text-align: left; }
.ab-row:hover { background: var(--bg); }
.ab-row .t, .book-item .t { flex: 1; min-width: 0; }
.ab-row strong, .book-item strong { display: block; font-size: 14.5px; font-weight: 600; }
.ab-row small, .book-item small { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-row .go { color: var(--muted); }
.av { width: 36px; height: 36px; border-radius: 99px; display: grid; place-items: center; flex: none; background: var(--soft); color: var(--brand); font-size: 13px; font-weight: 700; letter-spacing: .02em; }
.av.big { width: 52px; height: 52px; font-size: 17px; }

.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.check-row small { color: var(--muted); }
.cov-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.token em { font-style: normal; font-family: var(--font-body); opacity: .75; margin-left: 4px; }

/* Große Fenster */
.sheet.wide { width: min(1120px, 100%); height: min(780px, calc(100vh - 48px)); display: flex; flex-direction: column; overflow: hidden; }
.sheet-head h3 { display: flex; align-items: center; gap: 10px; }
.sheet-head h3 .icon { width: 22px; height: 22px; }
.sheet.wide .sheet-head { padding-bottom: 16px; border-bottom: 1px solid var(--line); gap: 8px; }
.btn.danger { background: #B3261E; border-color: #B3261E; color: #fff; }
.search { position: relative; flex: 1; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search .inp { padding-left: 36px; height: 40px; font-size: 14.5px; }

.book { flex: 1; display: grid; grid-template-columns: 340px 1fr; min-height: 0; }
.book-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: #FBFAF8; }
.book-filter { padding: 14px; display: grid; gap: 8px; border-bottom: 1px solid var(--line); }
.book-filter select.inp { height: 38px; font-size: 14px; }
.book-list { overflow: auto; flex: 1; padding: 6px; }
.book-item { border-radius: 10px; }
.book-item:hover { background: #F1F0EC; }
.book-item.on { background: #E9E7E1; }
.book-item .av { background: #E4E2DC; color: #555; }
.book-item .dots { display: flex; gap: 3px; }
.book-item .dots i { width: 8px; height: 8px; border-radius: 99px; display: block; }
.book-main { overflow: auto; min-height: 0; }
.book-empty { height: 100%; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); text-align: center; }
.book-empty .icon { width: 44px; height: 44px; stroke-width: 1.3; }
.book-edit { padding: 22px 26px; }
.book-edit-head { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.book-edit-head h4 { margin: 0; font-size: 20px; }
.book-edit-head small { color: var(--muted); }
.book-edit-head .av { background: #1D1D1F; color: #fff; }
.form-grid.compact { gap: 12px 12px; }
.form-grid.compact .inp { height: 40px; font-size: 14.5px; }
.form-grid.compact textarea.inp { height: auto; min-height: 64px; }
.form-grid.compact .field label { font-size: 12.5px; }
.form-grid.compact .seg-btn { padding: 6px 14px; font-size: 13.5px; }
.org-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.org-chip { border: 1.5px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: #555; }
.org-chip.on { background: var(--c); border-color: var(--c); color: var(--ci); }
.book-actions { display: flex; gap: 8px; align-items: center; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Archiv */
.arch-filter { display: flex; gap: 8px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.arch-filter select.inp { width: auto; height: 40px; font-size: 14px; }
#arch-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.arch-sums { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; padding: 12px 24px; font-size: 13.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.arch-sums .sum { color: var(--text); background: var(--bg); padding: 3px 10px; border-radius: 99px; }
.arch-wrap { overflow: auto; flex: 1; }
table.arch { width: 100%; border-collapse: collapse; font-size: 14px; }
table.arch th { position: sticky; top: 0; background: #fff; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.arch td { padding: 9px 12px; border-bottom: 1px solid #F0EEE9; vertical-align: middle; }
table.arch td small { display: block; color: var(--muted); font-size: 12px; }
table.arch tr:hover td { background: #FAF9F6; }
table.arch th:first-child, table.arch td:first-child { padding-left: 24px; }
table.arch .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.arch .act { white-space: nowrap; text-align: right; padding-right: 18px; }
table.arch .act .btn { height: 30px; padding: 0 8px; }
.odot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 8px; vertical-align: 1px; }
