/* =============================================================================
   APS-Support – Stylesheet
   ========================================================================== */

/* --- Schriften (lokal, aus @fontsource) ---------------------------------- */
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/hanken-grotesk-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/hanken-grotesk-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/hanken-grotesk-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/hanken-grotesk-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/hanken-grotesk-latin-ext-600-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/hanken-grotesk-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/hanken-grotesk-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/hanken-grotesk-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/hanken-grotesk-latin-ext-800-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Hanken Grotesk"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/hanken-grotesk-latin-800-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --brand: #a4112e;
  --brand-hover: #8a0e27;
  --brand-soft: #f7e6ea;
  --brand-soft-text: #7d0c22;
  --brand-ink: #ffffff;

  --bg: #f4f3f2;
  --surface: #ffffff;
  --surface-2: #f8f7f6;
  --surface-3: #eeecea;
  --text: #2a2224;
  --text-2: #4b3d3f;
  --muted: #7a7073;
  --border: #e2e2e2;
  --border-strong: #c9c5c4;
  --link: #a4112e;
  --focus: #2563eb;

  --ok: #15803d;      --ok-soft: #dcfce7;
  --warn: #b45309;    --warn-soft: #fef3c7;
  --info: #1d4ed8;    --info-soft: #dbeafe;
  --neutral-soft: #eeecea;

  --shadow-1: none;
  --shadow-2: 0 4px 14px rgba(20, 20, 30, .10), 0 2px 4px rgba(20, 20, 30, .06);
  --shadow-3: 0 12px 32px rgba(20, 20, 30, .16), 0 4px 10px rgba(20, 20, 30, .08);

  --radius: 0px;
  --radius-sm: 0px;
  --font: "Hanken Grotesk", "HK Grotesk", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --topbar-h: 60px;
  --container: 1240px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #a4112e;
    --brand-hover: #c0163a;
    --brand-soft: #3a1219;
    --brand-soft-text: #f5a7b3;
    --bg: #161314;
    --surface: #1f1b1c;
    --surface-2: #262122;
    --surface-3: #2e2829;
    --text: #ece8e8;
    --text-2: #c8c1c2;
    --muted: #918a8b;
    --border: #332d2e;
    --border-strong: #463f40;
    --link: #f08a9a;
    --ok: #4ade80;   --ok-soft: #14301f;
    --warn: #fbbf24; --warn-soft: #3a2a08;
    --info: #93c5fd; --info-soft: #172554;
    --neutral-soft: #2a2b31;
    --shadow-1: none;
    --shadow-2: 0 4px 14px rgba(0,0,0,.5);
    --shadow-3: 0 12px 32px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --brand: #a4112e;
  --brand-hover: #c0163a;
  --brand-soft: #3a1219;
  --brand-soft-text: #f5a7b3;
  --bg: #161314;
  --surface: #1f1b1c;
  --surface-2: #262122;
  --surface-3: #2e2829;
  --text: #ece8e8;
  --text-2: #c8c1c2;
  --muted: #918a8b;
  --border: #332d2e;
  --border-strong: #463f40;
  --link: #f08a9a;
  --ok: #4ade80;   --ok-soft: #14301f;
  --warn: #fbbf24; --warn-soft: #3a2a08;
  --info: #93c5fd; --info-soft: #172554;
  --neutral-soft: #2a2b31;
  --shadow-1: none;
  --shadow-2: 0 4px 14px rgba(0,0,0,.5);
  --shadow-3: 0 12px 32px rgba(0,0,0,.6);
}

/* --- Reset / Basis ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }
img { max-width: 100%; }
small { font-size: .85em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex: none; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 1000; }
.skip-link:focus { left: 1rem; top: 1rem; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; width: 100%; }
.layout-wide .container { max-width: 1500px; }
.main { flex: 1; padding: 24px 0 48px; }

/* --- Topbar / Navigation ---------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}
.topbar-inner { display: flex; align-items: center; gap: 10px; min-height: var(--topbar-h); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); margin-right: 8px; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 34px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: .95rem; letter-spacing: -.01em; }
.brand-sub { font-size: .72rem; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 2px; flex: 1; }
.nav-spacer { flex: 1; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px; border: 0; background: none;
  color: var(--text-2); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link.is-active { color: var(--brand); background: var(--brand-soft); }
.nav-link .caret { width: .9em; height: .9em; opacity: .6; transition: transform .15s; }
.nav-item.is-open > .nav-link .caret { transform: rotate(180deg); }
.nav-link-secondary { color: var(--muted); }
.nav-item { position: relative; }
.menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  min-width: 240px; padding: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-3);
}
.nav-item.is-open > .menu { display: block; }
.menu-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px;
  color: var(--text); white-space: nowrap;
}
.menu-link:hover { background: var(--surface-3); text-decoration: none; }
.menu-link.is-current { background: var(--brand-soft); color: var(--brand-soft-text); }
.menu-link .icon { color: var(--muted); }
.menu-mega { display: none; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 4px 18px; padding: 14px; width: max-content; max-width: min(92vw, 900px); }
.nav-item.is-open > .menu-mega { display: grid; }
.mega-group { padding: 4px 0; }
.mega-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 4px 10px 6px; }
.menu-mega .menu-link { padding: 5px 10px; gap: 8px; }
.kap-key { font-weight: 600; min-width: 2.6em; font-variant-numeric: tabular-nums; }
.kap-title { color: var(--text-2); font-size: .9em; white-space: normal; }
.count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--brand); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1;
  margin-left: auto;
}
.nav-link .count { margin-left: 2px; }
.nav-toggle { display: none; margin-left: auto; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: 8px; border: 0; background: none; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.theme-moon { display: none; }
[data-theme="dark"] .theme-moon { display: block; }
[data-theme="dark"] .theme-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-moon { display: block; }
  :root:not([data-theme="light"]) .theme-sun { display: none; }
}

@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-2);
    padding: 10px 14px 14px; max-height: calc(100vh - var(--topbar-h)); overflow: auto;
  }
  .nav.is-open { display: flex; }
  .nav-link { width: 100%; justify-content: flex-start; }
  .nav-spacer { display: none; }
  .menu, .menu-mega { position: static; box-shadow: none; border: 0; padding: 4px 0 8px 12px; width: auto; max-width: none; grid-template-columns: 1fr; }
  .brand-text { display: none; }
}

/* --- Seitenkopf -------------------------------------------------------------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 20px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.7rem; }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); font-weight: 600; margin-bottom: 4px; }
.subtitle { color: var(--text-2); margin: 4px 0 0; max-width: 60rem; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.intro { max-width: 64rem; color: var(--text-2); margin-bottom: 20px; }

/* --- Karten ------------------------------------------------------------------ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-1); margin-bottom: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header h2 { display: flex; align-items: center; gap: 8px; }
.card-header .hint { color: var(--muted); font-size: .85rem; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-empty { opacity: .6; box-shadow: none; background: var(--surface-2); border-style: dashed; }
.card-empty .card-header { border-bottom: 0; }
.card-empty .badge { background: transparent; border: 1px solid var(--border-strong); }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.stack { display: block; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.grid-sidebar { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .grid-2, .grid-3, .grid-sidebar { grid-template-columns: 1fr; } }

/* Stat-Kacheln */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; color: var(--text); box-shadow: var(--shadow-1); }
a.stat:hover { border-color: var(--border-strong); text-decoration: none; box-shadow: var(--shadow-2); }
.stat-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.stat.accent .stat-value { color: var(--brand); }

/* --- Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap; line-height: 1.2; text-decoration: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: .88rem; border-radius: 6px; }
.btn-block { width: 100%; }
.actions { display: inline-flex; gap: 4px; align-items: center; }
.action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 7px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); cursor: pointer; padding: 0;
}
.action:hover { background: var(--surface-3); color: var(--text); border-color: var(--border); text-decoration: none; }
.action.primary { color: var(--brand); }
.action.primary:hover { background: var(--brand-soft); border-color: transparent; }
.action .icon { width: 18px; height: 18px; }
.action.muted { color: var(--muted); opacity: .55; }
.action.muted:hover { opacity: 1; }
.field-hint { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.field-hint a { word-break: break-all; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .82rem; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.check-inline input { margin: 0; accent-color: var(--brand); }
.tag-watch { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 1px 7px; font-size: .68rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--brand); background: var(--brand-soft); vertical-align: middle; }
.tag-watch .icon { width: 11px; height: 11px; }
.icon-btn-active { color: #fff !important; background: rgba(255,255,255,.18); }
.card-admin { border-left: 3px solid var(--brand); }
.table-compact td, .table-compact th { padding-top: 7px; padding-bottom: 7px; }
.tag-plus { display: inline-block; margin-left: 5px; padding: 0 6px; font-family: var(--mono); font-size: .68rem; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border); cursor: help; vertical-align: middle; }
.card-collapsed > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 18px; }
.card-collapsed > summary::-webkit-details-marker { display: none; }
.card-collapsed > summary h2 { margin: 0; font-size: 1.05rem; display: inline-flex; align-items: center; gap: 8px; }
.card-collapsed > summary .hint { margin-left: auto; }
.card-collapsed > summary .chev { transition: transform .15s; }
.card-collapsed[open] > summary .chev { transform: rotate(90deg); }
form.inline { display: inline; margin: 0; }

/* --- Formulare ---------------------------------------------------------------- */
label { font-weight: 500; }
.field { margin-bottom: 14px; }
.field > label, .field-label { display: block; font-size: .85rem; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.input, .select, .textarea, input[type="text"], input[type="password"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; line-height: 1.3;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
select { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2374767f' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }
select.compact { width: auto; padding: 5px 28px 5px 8px; font-size: .9rem; border-radius: 6px; }
textarea { min-height: 120px; resize: vertical; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 160px; margin: 0; }
.help { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.checkbox { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; font-weight: 400; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--brand); flex: none; }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; cursor: pointer; transition: .2s; }
.switch .slider::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(14px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--focus); outline-offset: 2px; }

/* --- Badges / Labels --------------------------------------------------------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 600; line-height: 1.4; white-space: nowrap; background: var(--neutral-soft); color: var(--text-2); }
.badge-motion { background: #dbeafe; color: #1e40af; }
.badge-postulat { background: #e0e7ff; color: #3730a3; }
.badge-interpellation { background: #fef3c7; color: #92400e; }
.badge-initiative { background: #dcfce7; color: #166534; }
.badge-bundesrat { background: #fbe9ec; color: #8e0a1f; }
.badge-parlament { background: #ede9fe; color: #5b21b6; }
.badge-anfrage { background: #f3f4f6; color: #374151; }
.badge-medien { background: #cffafe; color: #155e75; }
.badge-leges { background: #fce7f3; color: #9d174d; }
[data-theme="dark"] .badge-motion, [data-theme="dark"] .badge-postulat, [data-theme="dark"] .badge-interpellation,
[data-theme="dark"] .badge-initiative, [data-theme="dark"] .badge-bundesrat, [data-theme="dark"] .badge-parlament,
[data-theme="dark"] .badge-anfrage, [data-theme="dark"] .badge-medien, [data-theme="dark"] .badge-leges { filter: brightness(.75) saturate(1.2); color: #fff; }
.phase-neu { background: var(--warn-soft); color: var(--warn); }
.phase-kneu { background: var(--brand-soft); color: var(--brand-soft-text); }
.phase-watch { background: var(--info-soft); color: var(--info); }
.phase-basis { background: var(--ok-soft); color: var(--ok); }
.phase-archiv { background: var(--neutral-soft); color: var(--muted); }
.prio { display: inline-block; font-weight: 600; font-size: .85rem; padding: 1px 8px; border-radius: 6px; }
.prio-1 { background: var(--brand-soft); color: var(--brand-soft-text); }
.prio-2 { background: var(--warn-soft); color: var(--warn); }
.prio-3 { background: var(--neutral-soft); color: var(--text-2); }
.prio-0 { color: var(--muted); }
.tag-new { display: inline-block; background: var(--brand); color: #fff; font-size: .68rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; vertical-align: middle; margin-left: 6px; text-transform: uppercase; letter-spacing: .04em; }
.status-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.status-offen { background: var(--neutral-soft); color: var(--text-2); }
.status-arbeit, .status-todo { background: var(--warn-soft); color: var(--warn); }
.status-fertig, .status-ja, .status-erledigt { background: var(--ok-soft); color: var(--ok); }
.status-nein { background: var(--neutral-soft); color: var(--muted); }

/* --- Flash ------------------------------------------------------------------- */
.flash { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash-success { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash-error { background: var(--brand-soft); color: var(--brand-soft-text); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.flash-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.flash span { flex: 1; }
.flash-close { background: none; border: 0; color: inherit; cursor: pointer; opacity: .7; padding: 2px; display: inline-flex; }
.flash-close:hover { opacity: 1; }

/* --- Tabellen ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table thead th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.actions-cell { white-space: nowrap; text-align: right; padding-top: 6px; padding-bottom: 6px; }
.table th.actions-col { text-align: right; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .date { white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }
.table .title-cell { min-width: 260px; }
.table .nummer { font-weight: 600; white-space: nowrap; }
.table .nummer a { color: var(--brand); }
.table .sub { display: block; font-size: .8rem; color: var(--muted); margin-top: 2px; }
.table.compact th, .table.compact td { padding: 7px 10px; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th.sortable::after { content: "↕"; opacity: .35; margin-left: 5px; font-size: .9em; }
.table th.sort-asc::after { content: "↑"; opacity: 1; color: var(--brand); }
.table th.sort-desc::after { content: "↓"; opacity: 1; color: var(--brand); }
.table th.no-sort::after { content: none; }

/* DataTable-Toolbar */
.dt { }
.dt-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dt-toolbar .dt-search { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.dt-toolbar .dt-search input { padding-left: 34px; }
.dt-toolbar .dt-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.dt-toolbar .dt-length { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); margin-left: auto; }
.dt-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.dt-pages { display: flex; gap: 4px; align-items: center; }
.dt-pages button { min-width: 32px; height: 32px; padding: 0 8px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--text-2); font: inherit; cursor: pointer; }
.dt-pages button:hover { background: var(--surface-3); }
.dt-pages button.is-current { background: var(--brand); color: #fff; }
.dt-pages button:disabled { opacity: .4; cursor: default; background: none; }
.dt-empty { padding: 36px 18px; text-align: center; color: var(--muted); }
.dt-empty .icon { width: 28px; height: 28px; opacity: .5; display: block; margin: 0 auto 8px; }
tr.dt-hidden { display: none; }

/* --- Listenkarten (Kapitel: neu / Watchlist) ------------------------------ */
.item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--surface-2); }
.item-main { flex: 1; min-width: 0; }
.item-meta { font-size: .78rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 2px; }
.item-title { line-height: 1.35; }
.item-title .nummer { font-weight: 600; color: var(--brand); }
.item-side { display: flex; gap: 6px; align-items: center; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.accept-form { display: flex; gap: 6px; align-items: center; }
.accept-form select { width: 200px; }
@media (max-width: 700px) { .item { flex-direction: column; } .item-side { justify-content: flex-start; } .accept-form select { width: 100%; } }

/* --- Detailseite ---------------------------------------------------------------- */
.detail-head { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.detail-title { font-size: 1.35rem; font-weight: 600; margin-top: 6px; line-height: 1.3; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; }
.action-list { display: flex; flex-direction: column; gap: 6px; }
.action-list .btn { justify-content: flex-start; }

/* --- Login ---------------------------------------------------------------- */
.login-wrap { min-height: calc(100vh - 100px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; }
.login-logo { height: 56px; margin: 4px auto 12px; display: block; }

/* --- Migration ---------------------------------------------------------------- */
.filter-panel details { border-bottom: 1px solid var(--border); }
.filter-panel details:last-of-type { border-bottom: 0; }
.filter-panel summary { display: flex; align-items: center; gap: 8px; padding: 10px 16px; cursor: pointer; font-weight: 600; font-size: .9rem; list-style: none; }
.filter-panel summary::-webkit-details-marker { display: none; }
.filter-panel summary .icon { margin-left: auto; width: 16px; height: 16px; opacity: .6; transition: transform .15s; }
.filter-panel details[open] summary .icon { transform: rotate(90deg); }
.filter-panel summary .count { margin-left: 0; }
.filter-list { max-height: 260px; overflow: auto; padding: 0 12px 10px; }
.filter-list .checkbox { padding: 3px 4px; font-size: .9rem; border-radius: 4px; }
.filter-list .checkbox:hover { background: var(--surface-2); }
.filter-list .fcount { margin-left: auto; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.filter-search { padding: 0 12px 8px; }
.filter-search input { padding: 5px 8px; font-size: .88rem; border-radius: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-soft-text); font-size: .8rem; font-weight: 500; }
.chip a { color: inherit; display: inline-flex; }
.chip .icon { width: 14px; height: 14px; }
.article-text { font-size: .95rem; line-height: 1.65; }
.article-text p { margin-bottom: .9rem; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.check-group { margin-bottom: 14px; }
.check-group-head { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .9rem; margin: 6px 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.check-group-head .switch { margin-left: auto; }
.progress-bar { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--ok); }
.migration-nav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (max-width: 700px) { .check-grid { grid-template-columns: 1fr; } }

/* --- Sonstiges ---------------------------------------------------------------- */
.footer { border-top: 1px solid var(--border); padding: 16px 0; font-size: .8rem; color: var(--muted); background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a { color: var(--text-2); }
.empty { padding: 32px 18px; text-align: center; color: var(--muted); }
.empty .icon { width: 30px; height: 30px; opacity: .45; display: block; margin: 0 auto 8px; }
.linklist a { display: block; padding: 6px 0; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; align-items: center; }
.hero-logo { width: 100%; max-width: 220px; justify-self: end; }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; } .hero-logo { display: none; } }
.print-only { display: none; }
@media print {
  .topbar, .footer, .dt-toolbar, .dt-footer, .page-actions, .actions-cell, .actions-col { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
  tr.dt-hidden { display: table-row; }
}


/* =============================================================================
   Gestaltung angelehnt an anneepolitique.swiss: Dunkelrot als Fläche,
   Grotesk-Schrift, Monospace-Etiketten, keine Rundungen, feine Linien.
   ========================================================================== */
h1, h2, h3 { letter-spacing: -.015em; }
.page-header h1 { font-size: 2rem; font-weight: 800; color: var(--brand); line-height: 1.15; }
.eyebrow, .mega-title, .table thead th, .field > label, .field-label, .dt-length, .stat-label, .check-group-head, .filter-panel summary, .card-header .hint, .card-collapsed > summary .hint {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .08em; font-weight: 500;
}
.eyebrow { display: inline-block; border: 1px solid var(--brand); color: var(--brand); padding: 2px 8px; font-size: .72rem; margin-bottom: 10px; }
.table thead th { font-size: .68rem; letter-spacing: .1em; }
.field > label, .field-label { font-size: .7rem; color: var(--muted); }
.stat-label { font-size: .68rem; letter-spacing: .06em; }
.card-header .hint, .card-collapsed > summary .hint { font-size: .68rem; letter-spacing: .05em; color: var(--muted); }
.check-group-head { font-size: .72rem; }
.filter-panel summary { font-size: .74rem; }
.dt-length { text-transform: none; letter-spacing: 0; font-family: var(--font); }

/* Topbar in Dunkelrot */
.topbar { background: var(--brand); border-bottom: 0; box-shadow: none; }
.brand-name, .brand-sub { color: var(--brand-ink); }
.brand-sub { opacity: .75; }
.nav-link { color: rgba(255,255,255,.85); border-radius: 0; font-weight: 500; }
.nav-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-link.is-active { background: var(--surface); color: var(--brand); }
.nav-link-secondary { color: rgba(255,255,255,.65); }
.nav-link .count { background: #fff; color: var(--brand); }
.nav-link.is-active .count { background: var(--brand); color: #fff; }
.icon-btn { color: rgba(255,255,255,.85); border-radius: 0; }
.icon-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-toggle { color: #fff; }
.menu { border-radius: 0; border-color: var(--border); }
.menu-link { border-radius: 0; }
@media (max-width: 960px) { .nav { background: var(--brand); border-bottom: 0; } .menu-link { color: #fff; } .menu-link .icon, .kap-title { color: rgba(255,255,255,.7); } .menu, .menu-mega { background: transparent; } .mega-title { color: rgba(255,255,255,.6); } .menu-link:hover { background: rgba(255,255,255,.12); } .menu-link.is-current { background: #fff; color: var(--brand); } }

/* Flächen ohne Rundung und Schatten */
.card, .stat, .btn, .action, .badge, .status-pill, .prio, .chip, .tag-new, .flash, .dt-pages button, .count,
input, select, textarea, .input, .select, .textarea, .card-footer, .filter-list .checkbox, .switch .slider, .progress-bar, .demo-toast { border-radius: 0 !important; }
.card, .stat { box-shadow: none; }
.card-footer { background: var(--surface-2); }
.switch .slider::before, .progress-bar span { border-radius: 0; }
.badge { font-family: var(--mono); font-weight: 500; font-size: .68rem; letter-spacing: .04em; text-transform: uppercase; padding: 2px 6px; }
.count { min-width: 18px; height: 18px; font-family: var(--mono); }
.status-pill { font-family: var(--mono); font-size: .7rem; letter-spacing: .03em; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn { font-weight: 600; }

/* Kennzahlen als Fläche */
.stats .stat { border-color: var(--border); }
.stat.accent { background: var(--brand); border-color: var(--brand); color: #fff; }
.stat.accent .stat-value, .stat.accent .stat-label { color: #fff; }
.stat.accent .stat-label { opacity: .85; }

/* Startseite: Hero-Karte in Dunkelrot */
.hero-card { background: var(--brand); color: #fff; border: 0; }
.hero-card .eyebrow { border-color: rgba(255,255,255,.6); color: #fff; }
.hero-card h1 { color: #fff; font-size: 2.2rem; font-weight: 800; }
.hero-card p { color: rgba(255,255,255,.88); }
.hero-card a { color: #fff; text-decoration: underline; text-decoration-color: rgba(255,255,255,.5); }
.hero-card .hero-logo { filter: brightness(0) invert(1); opacity: .95; }

/* Login */
.login-card { border-top: 6px solid var(--brand); }

/* Tabellen: feine Linien */
.table tbody tr:hover { background: var(--surface-2); }
.table thead th { background: var(--surface); border-bottom: 2px solid var(--text); }

/* --- Sprungleiste auf der Kapitelseite ------------------------------------- */
.section-nav {
  position: sticky; top: var(--topbar-h); z-index: 40;
  display: flex; gap: 2px; align-items: center; flex-wrap: wrap;
  margin: -4px 0 18px; padding: 6px 0;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.section-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  color: var(--text-2); font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  border-bottom: 2px solid transparent; text-decoration: none;
}
.section-link:hover { color: var(--text); text-decoration: none; background: var(--surface-3); }
.section-link.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.section-link.is-empty { color: var(--muted); }
.section-link .icon { width: 15px; height: 15px; }
.section-count { font-weight: 500; padding: 0 5px; background: var(--surface-3); color: var(--text-2); min-width: 20px; text-align: center; }
.section-link.is-active .section-count { background: var(--brand); color: #fff; }
.section-link.is-empty .section-count { background: transparent; border: 1px solid var(--border-strong); }
.section-top { margin-left: auto; }
.section-top .icon { transform: rotate(90deg); }
.card[id] { scroll-margin-top: calc(var(--topbar-h) + 52px); }
@media (max-width: 700px) { .section-link { padding: 6px 8px; } .section-link .icon { display: none; } }

/* --- Kapitelmenü: flache Liste 1a, 1b, … (zwei Spalten am Desktop) ----------- */
.menu-kapitel { display: none; padding: 8px; width: max-content; max-width: min(94vw, 760px); max-height: calc(100vh - var(--topbar-h) - 24px); overflow: auto; }
.nav-item.is-open > .menu-kapitel { display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column; grid-template-rows: repeat(12, auto); gap: 0 10px; }
.menu-kapitel .menu-link { padding: 5px 10px; gap: 8px; }
.menu-kapitel .kap-title { white-space: nowrap; }
@media (max-width: 960px) {
  .nav-item.is-open > .menu-kapitel { display: block; max-height: none; width: auto; max-width: none; }
  .menu-kapitel .kap-title { white-space: normal; }
}

/* --- Seitenfilter (Kapitelseite) --------------------------------------------- */
.filter-bar { margin-bottom: 18px; }
.filter-bar.is-active { border-color: var(--brand); }
.filter-summary { padding: 0 18px 10px; font-size: .82rem; }
.filter-summary:empty { display: none; }
.filter-bar .btn-ghost { align-self: flex-end; }

/* --- Detail: neue Newsfeed-Einträge ------------------------------------------- */
.news-new { border-left: 4px solid var(--brand); }
.news-new-list { list-style: none; margin: 0; padding: 6px 18px 10px; }
.news-new-list li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.news-new-list li:last-child { border-bottom: 0; }
.news-new-list .date { color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 84px; }
a.tag-new { text-decoration: none; }

/* --- Zuordnungen (Redaktionsmodus) ---------------------------------------- */
.nav-link-admin .icon { width: 15px; height: 15px; margin-right: 4px; vertical-align: -2px; }
.table-zuordnung { table-layout: fixed; width: 100%; }
.table-zuordnung td { vertical-align: top; overflow-wrap: anywhere; }
.table-zuordnung .zu-main { font-size: .9rem; }
.table-zuordnung .zu-main .badge { margin-left: 6px; }
.table-zuordnung tr[id] { scroll-margin-top: calc(var(--topbar-h) + 56px); }
.table-zuordnung tr:target > td { background: var(--brand-soft); animation: zu-flash 2.4s ease-out forwards; }
@keyframes zu-flash { 0% { background: var(--brand-soft); } 70% { background: var(--brand-soft); } 100% { background: transparent; } }
.zu-list { display: flex; flex-wrap: wrap; gap: 6px; }
.zu-chip { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 2px 4px 2px 9px; font-size: .82rem; line-height: 1.3; background: var(--surface-3); border: 1px solid var(--border); border-radius: 0; color: var(--text); }
.zu-chip-x { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 20px; height: 20px; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.zu-chip-x:hover { color: var(--brand); background: var(--brand-soft); }
.zu-chip-x .icon { width: 13px; height: 13px; }
.zu-add-form { display: flex; gap: 6px; align-items: center; }
.zu-add-form select { min-width: 0; }
.zu-add-form select[name="zu_kapitel"] { width: 96px; flex: 0 0 auto; }
.zu-add-form select[name="zu_unterkapitel"] { flex: 1 1 auto; }
.zu-add-form .btn { flex: 0 0 auto; padding-left: 9px; padding-right: 9px; }
@media (max-width: 1100px) { .table-zuordnung { table-layout: auto; } .zu-add-form { flex-wrap: wrap; } }
.zu-back { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; font-size: .74rem; font-family: var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-decoration: none; }
.zu-back:hover { color: var(--brand); }
.zu-back .icon { width: 12px; height: 12px; }
.backlink-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: -6px 0 16px; font-size: .9rem; }
.zuteil-actions { display: inline-flex; gap: 6px; align-items: stretch; }
.btn-plus { padding-left: 9px; padding-right: 9px; border-color: var(--brand); color: var(--brand); }
.btn-plus:hover { background: var(--brand-soft); }

/* Neue Geschäfte auf dem Handy: Zeile als Block (Nummer · Datum / Titel / Kapitel + Zuteilen) */
@media (max-width: 720px) {
  .table-neue thead { display: none; }
  .table-neue tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table-neue tbody td { display: block; padding: 0; border: 0; background: transparent; }
  .table-neue td.nummer { order: 1; }
  .table-neue td.date { order: 2; margin-left: auto; font-size: .75rem; color: var(--muted); white-space: nowrap; }
  .table-neue td.title-cell { order: 3; flex: 1 1 100%; white-space: normal; max-width: none; }
  .table-neue td.kapitel-cell { order: 4; flex: 1 1 auto; }
  .table-neue td.kapitel-cell select { width: 100%; }
  .table-neue td.actions-cell { order: 5; flex: 0 0 auto; }
  .table-neue td.actions-cell form { display: block; }
}
