/* ==========================================================================
   Gutscheinportal – Ergänzungen zu ah-design.css
   Regel: ausschließlich Variablen aus ah-design.css verwenden, keine neuen Farben.
   ========================================================================== */

/* ---------- Grundgerüst ---------- */
body { display: flex; flex-direction: column; min-height: 100vh; }
.portal-main { flex: 1; padding-block: var(--space-4) var(--space-5); }
@media (min-width: 861px) {
  /* Platz für die überhängende Logo-Box */
  .portal-main { padding-top: 12rem; }
}
.portal-narrow { width: min(100% - 2.5rem, 46rem); margin-inline: auto; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-2); top: -4rem; z-index: 10;
  background: var(--ah-white); color: var(--ah-ink); padding: var(--space-1) var(--space-2);
}
.skip-link:focus { top: var(--space-1); }

/* ---------- Header-Ergänzungen ---------- */
.portal-header__tools { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
.portal-header__tools a { color: var(--on-red); font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: 1.1rem; text-decoration: none; }
.portal-header__tools a:hover { text-decoration: underline; text-underline-offset: 6px; }
.portal-label {
  display: inline-block; background: var(--ah-white); color: var(--ah-ink);
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  font-size: .85rem; padding: .15rem .6rem; border-radius: var(--radius-btn);
}
.portal-title {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase; letter-spacing: .1em;
  color: var(--on-red); font-size: 1.15rem; margin: 0;
}
@media (max-width: 860px) {
  .portal-title { display: none; }
}

/* ---------- Typografie im Portal ---------- */
.portal-h1 { color: var(--text-accent); }
.portal-lead { font-size: 1.15rem; }
.portal-muted { color: var(--text-soft); font-size: var(--fs-small); }

/* ---------- Buttons (Ergänzungen) ---------- */
.ah-btn--secondary {
  background: var(--ah-white); color: var(--ah-red); border: 2px solid var(--ah-red);
  padding: calc(1.05rem - 2px) calc(2rem - 2px);
}
.ah-btn--secondary:hover { background: var(--bg-section); color: var(--ah-red-dark); border-color: var(--ah-red-dark); }
.ah-btn--small { font-size: .95rem; padding: .6rem 1.1rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* ---------- Hinweisboxen (Rosa/Mauve nur hier) ---------- */
.notice {
  background: var(--surface-campaign); color: var(--ah-ink); border-radius: var(--radius-panel);
  padding: var(--space-2) var(--space-3); margin: 0 0 var(--space-3);
}
.notice--info { background: var(--bg-section); border-left: 4px solid var(--ah-sand); border-radius: 0; }
.notice--error { background: var(--ah-white); border: 2px solid var(--ah-red); border-radius: 0; }
.notice--success { background: var(--bg-section); border-left: 4px solid var(--ah-ink); border-radius: 0; }
.notice > :last-child { margin-bottom: 0; }

/* ---------- Dashboard-Kacheln ---------- */
.tiles { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tile {
  background: var(--surface-card); box-shadow: var(--shadow-card); color: var(--ah-ink);
  padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-1); text-decoration: none;
}
.tile__title {
  font-family: var(--font-display); font-weight: 500; text-transform: uppercase; color: var(--ah-red);
  font-size: 1.4rem; line-height: 1.2; margin: 0;
}
.tile__value { font-family: var(--font-display); font-weight: 700; color: var(--ah-red); font-size: 2.6rem; line-height: 1; }
.tile__text { margin: 0; font-size: .95rem; line-height: 1.6; }
a.tile:hover .tile__title { text-decoration: underline; }
.tile--primary { background: var(--ah-red); color: var(--on-red); }
.tile--primary .tile__title, .tile--primary .tile__value { color: var(--on-red); }
.tile[aria-disabled="true"] { box-shadow: none; cursor: default; }
.tile--primary[aria-disabled="true"] { background: var(--surface-card); color: var(--ah-ink); }
.tile--primary[aria-disabled="true"] .tile__title { color: var(--ah-red); }

/* ---------- Formulare ---------- */
.form { display: grid; gap: var(--space-3); }
.field { display: grid; gap: .35rem; }
.field label, .field legend { font-weight: 600; }
.field .help { color: var(--text-soft); font-size: var(--fs-small); margin: 0; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="tel"], .field input[type="url"], .field input[type="number"],
.field input[type="date"], .field input[type="file"], .field select, .field textarea {
  font: inherit; color: var(--ah-ink); background: var(--ah-white);
  border: 1.5px solid var(--ah-ink-soft); border-radius: var(--radius-btn);
  padding: .65rem .8rem; width: 100%; min-height: 2.9rem;
}
.field textarea { min-height: 8rem; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { border-color: var(--ah-ink); }
.field--error input, .field--error select, .field--error textarea { border-color: var(--ah-red); border-width: 2px; }
.field__error { color: var(--ah-red); font-weight: 600; font-size: .95rem; margin: 0; }
.field fieldset { border: 0; padding: 0; margin: 0; }
.check { display: flex; gap: .75rem; align-items: flex-start; }
.check input { width: 1.3rem; height: 1.3rem; margin-top: .3rem; flex: 0 0 auto; accent-color: var(--ah-red); }
.form-grid { display: grid; gap: var(--space-2) var(--space-3); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- Assistent: Fortschritt ---------- */
.steps { list-style: none; padding: 0; margin: 0 0 var(--space-4); display: flex; flex-wrap: wrap; gap: .4rem; counter-reset: step; }
.steps li {
  counter-increment: step; flex: 1 1 0; min-width: 2.2rem; text-align: center;
  font-family: var(--font-display); text-transform: uppercase; font-size: .85rem; letter-spacing: .04em;
  border-top: 5px solid #d6d2cb; padding-top: .4rem; color: var(--text-soft);
}
/* Nur Rot und neutrales Grau: Schwarz-Rot-Gelb nebeneinander wirkte wie eine Flagge */
.steps li::before { content: counter(step); display: block; font-weight: 700; font-size: 1.2rem; }
.steps li[aria-current="step"] { border-top: 8px solid var(--ah-red); padding-top: .1rem; color: var(--ah-red); }
.steps li.done { border-color: var(--ah-red); color: var(--text-soft); }
.steps li.done::before { content: "✓ " counter(step); }
@media (max-width: 600px) { .steps li span { display: none; } }

/* ---------- Statusbadges ---------- */
.badge {
  display: inline-block; background: var(--bg-section); color: var(--ah-ink);
  border: 1px solid var(--ah-sand); font-size: .8rem; font-weight: 600; line-height: 1.4;
  padding: .1rem .55rem; border-radius: var(--radius-btn); white-space: nowrap;
}
.badge--sand { background: var(--ah-sand); border-color: var(--ah-sand); }
.badge--alert { background: var(--ah-white); border: 2px solid var(--ah-red); }
.badge--ok::before { content: "✓ "; }

/* ---------- Tabellen und Filterleisten (Verwaltung) ---------- */
.table-wrap { overflow-x: auto; position: relative; } /* hält absolut positionierte, versteckte Beschriftungen im Scrollbereich */
.table { width: 100%; border-collapse: collapse; font-size: .95rem; line-height: 1.5; }
.table th, .table td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--ah-sand); vertical-align: top; }
.table th { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; background: var(--bg-section); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.filterbar { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: end; background: var(--bg-section); padding: var(--space-2); margin-bottom: var(--space-3); }

/* ---------- Karten im Portal (ohne Foto) ---------- */
.ah-card__num {
  font-family: var(--font-display); font-weight: 700; font-size: 2.5rem; line-height: 1; color: var(--ah-red);
}

/* ---------- Druck ---------- */
@media print {
  .ah-header, .ah-footer, .skip-link, .no-print, .btn-row { display: none !important; }
  .portal-main { padding: 0; }
  body { font-size: 11pt; color: var(--ah-ink); background: var(--ah-white); }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Footer / Startseite ---------- */
.portal-footer-logo { width: 180px; margin-bottom: var(--space-2); }
.portal-hero { padding-bottom: var(--space-4); }
.portal-hero .portal-lead { text-align: left; }
.portal-hero .ah-claim { margin-bottom: var(--space-3); }
.portal-hero .btn-row { justify-content: center; }
.portal-steps-num {
  font-family: var(--font-display); font-weight: 700; font-size: 3rem; line-height: 1; color: var(--ah-red);
  margin-bottom: var(--space-1);
}
.portal-error { text-align: center; padding-block: var(--space-4); }
.portal-error__code {
  font-family: var(--font-display); font-weight: 700; color: var(--text-accent);
  font-size: clamp(4rem, 3rem + 6vw, 8rem); line-height: 1; margin: 0;
}
.portal-error .btn-row { justify-content: center; }
.portal-prose h2 { color: var(--text-accent); font-size: var(--fs-h3); margin-top: var(--space-4); }

/* ---------- Navigation (angemeldet) ---------- */
.portal-header__brand { display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; }
.ah-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; }
.portal-logout { display: inline; margin: 0; }
.portal-logout button {
  background: none; border: 0; cursor: pointer; color: var(--on-red); padding: .5rem 0;
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase; font-size: 1.15rem;
  line-height: inherit; letter-spacing: .01em;
}
.portal-logout button:hover { text-decoration: underline; text-underline-offset: 6px; }
@media (max-width: 860px) {
  .portal-header__brand { margin-left: auto; align-items: flex-end; }
}

/* ---------- Konto, 2FA ---------- */
.field__req { color: var(--ah-red); }
.panel-box { background: var(--bg-section); padding: var(--space-3); margin-bottom: var(--space-3); }
.panel-box > :last-child { margin-bottom: 0; }
.panel-box h2 { font-size: var(--fs-h3); color: var(--text-accent); }
/* Linke Spalte höchstens 45 % breit, sonst bleibt rechts kein Platz (Ziffern untereinander) */
.dl { display: grid; grid-template-columns: fit-content(45%) minmax(0, 1fr); gap: .25rem var(--space-2); margin: 0; }
@media (max-width: 600px) {
  .dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .dl dt { margin-top: .6rem; }
  .dl dt:first-child { margin-top: 0; }
}
.dl dt { font-weight: 600; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.grid-2 > * { min-width: 0; }
.mono-break { font-family: ui-monospace, monospace; font-size: .85em; word-break: break-all; }
.qr { background: var(--ah-white); display: block; width: max-content; margin-block: var(--space-1); padding: var(--space-1); border: 1px solid var(--ah-sand); }
.qr img { width: 220px; height: 220px; }
.code { font-family: var(--font-body); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 1.05rem; letter-spacing: .08em; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .5rem; }
.codes li { background: var(--ah-white); border: 1px solid var(--ah-sand); padding: .4rem .6rem; text-align: center; }
.inline-form { display: inline; margin: 0; }
.linkbutton { background: none; border: 0; padding: 0; color: var(--text-accent); text-decoration: underline; cursor: pointer; font: inherit; }
.stack > * + * { margin-top: var(--space-3); }
.mt-2 { margin-top: var(--space-2); } .mt-3 { margin-top: var(--space-3); } .mt-4 { margin-top: var(--space-4); }
.portal-narrow-left { max-width: 46rem; }

/* ---------- Verwaltung: dichter, Unternavigation ---------- */
.verwaltung { font-size: .97rem; }
.verwaltung h1 { font-size: var(--fs-h2); color: var(--text-accent); }
.verwaltung h2 { font-size: var(--fs-h3); margin-top: var(--space-4); }
.subnav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; border-bottom: 2px solid var(--ah-sand); margin-bottom: var(--space-3); padding-bottom: .4rem; }
.subnav a { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ah-ink); text-decoration: none; font-size: 1.05rem; }
.subnav a[aria-current="page"], .subnav a:hover { color: var(--ah-red); text-decoration: underline; text-underline-offset: 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.filterbar .field { min-width: 10rem; }
.filterbar .field input, .filterbar .field select { min-height: 2.4rem; padding: .35rem .6rem; }
.progress { width: 100%; height: 1.4rem; background: var(--bg-section); border: 1px solid var(--ah-sand); }
.progress__bar { height: 100%; background: var(--ah-red); }
.pagination { display: flex; gap: var(--space-2); margin-top: var(--space-2); align-items: center; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--ah-sand); }
.timeline li { padding: 0 0 var(--space-2) var(--space-2); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -.55rem; top: .55rem; width: .75rem; height: .75rem; background: var(--ah-red); border-radius: 50%; }
.grid-2 { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.ampel-ok::before { content: "● "; color: var(--ah-ink); }
.ampel-fehler::before { content: "● "; color: var(--ah-red); }
.danger-zone { border: 2px solid var(--ah-red); padding: var(--space-2); margin-top: var(--space-3); }
.num-input { width: 6rem; text-align: right; font: inherit; padding: .3rem .5rem; border: 1.5px solid var(--ah-ink-soft); }
.sel-vendor { font-size: 1.2rem; color: var(--text-accent); margin: var(--space-2) 0 .25rem; }
.sel-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid var(--ah-sand); }
.stepper { display: flex; align-items: center; gap: .4rem; }
.stepper .ah-btn--small { padding: .35rem .8rem; min-width: 2.6rem; }
.sel-total { margin-top: var(--space-2); font-size: 1.1rem; }
.pdf-preview { width: 100%; max-width: 40rem; height: 32rem; border: 1px solid var(--ah-sand); }
[hidden] { display: none !important; }
.chart { position: relative; height: 16rem; margin-bottom: var(--space-2); }
fieldset.field, fieldset.panel-box { border: 0; margin: 0; min-width: 0; }
fieldset.field { padding: 0; }
fieldset legend { font-weight: 600; padding: 0; margin-bottom: .35rem; }
.check label { font-weight: 400; }
.field__label { font-weight: 600; }

/* ==========================================================================
   Statistik: Deutschlandkarte (apps/geo, templates/statistics/karte.html)
   ========================================================================== */
.karte-controls { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; background: var(--bg-section); padding: var(--space-2); margin-bottom: var(--space-3); }
.karte-seg { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.karte-seg__label { font-weight: 600; margin-right: .25rem; }
.karte-seg__item {
  display: inline-block; padding: .3rem .8rem; border: 1.5px solid var(--ah-red); border-radius: var(--radius-btn);
  color: var(--text-accent); background: transparent; text-decoration: none; font-size: .95rem; line-height: 1.4;
}
.karte-seg__item:hover { text-decoration: underline; }
.karte-seg__item[aria-current="true"] { background: var(--ah-red); color: var(--on-red); }
.karte-layer { align-items: center; }
.karte-layer input { margin-top: 0; }
.karte-layout { display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .karte-layout { grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr); }
  .karte-panel { position: sticky; top: var(--space-2); }
}
.karte-map { margin: 0; }
.karte-svg { display: block; width: 100%; height: auto; max-height: 80vh; }
.karte-laender path { fill: var(--bg-section); stroke: var(--ah-sand); stroke-width: 1.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.karte-bubble {
  fill: var(--ah-red); fill-opacity: .45; stroke: var(--ah-red-dark); stroke-width: 1;
  vector-effect: non-scaling-stroke; cursor: pointer;
}
.karte-bubble:hover { fill-opacity: .7; }
.karte-bubble--klein { fill-opacity: .2; stroke-dasharray: 2 2; }
.karte-bubble.is-selected { fill-opacity: .8; stroke: var(--text); stroke-width: 2.5; }
.karte-bubble:focus { outline: none; }
.karte-bubble:focus-visible { stroke: var(--ah-gold); stroke-width: 3; }
.karte-stelle { fill: var(--text); stroke: var(--bg); stroke-width: .8; vector-effect: non-scaling-stroke; }
.karte-stellen.is-hidden { display: none; }
.karte-legend { display: flex; flex-wrap: wrap; gap: .25rem var(--space-2); align-items: center; font-size: var(--fs-small); margin-top: var(--space-1); }
.karte-key { display: inline-block; width: .9rem; height: .9rem; vertical-align: -.1rem; margin-right: .2rem; }
.karte-key--bubble { border-radius: 50%; background: var(--ah-red); opacity: .6; border: 1px solid var(--ah-red-dark); }
.karte-key--klein { border-radius: 50%; border: 1px dashed var(--ah-red-dark); }
.karte-key--stelle { width: .55rem; height: .55rem; background: var(--text); }
.karte-panel h2 { margin-top: 0; }
.karte-panel__title { color: var(--text-accent); margin-bottom: .1rem; }
.karte-panel__title + p { margin-top: 0; }

/* ---- Budget und Sonderkontingente ---------------------------------------- */
.budget-box { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; padding: var(--space-2) var(--space-3); background: var(--bg-section); border-left: 4px solid var(--text-accent); margin: 0 0 var(--space-2); }
.budget-box__main { display: flex; flex-direction: column; }
.budget-box__label { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.budget-box__value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: var(--text-accent); line-height: 1.1; }
.budget-box__parts { list-style: none; margin: 0; padding: 0; flex: 1 1 16rem; min-width: 0; }
.budget-box__special { margin-top: .25rem; }
.inline-search { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.inline-search input { flex: 1 1 12rem; min-width: 0; }
.plz-results { list-style: none; padding: 0; margin: 0 0 var(--space-2); display: grid; gap: .5rem; }
.plz-results li { display: flex; flex-wrap: wrap; gap: .25rem var(--space-2); align-items: center; justify-content: space-between; padding: .5rem .75rem; background: var(--bg-section); }
.plz-results .plz-ranges { flex-basis: 100%; font-size: .85rem; overflow-wrap: anywhere; }
.outflow-low td { background: var(--surface-campaign); }
.contract-text { max-height: 22rem; overflow-y: auto; padding: var(--space-2) var(--space-3); background: var(--bg-section); border: 1px solid var(--surface-card); font-size: var(--fs-small); line-height: 1.6; }
.contract-text:focus { outline: 2px solid var(--text-accent); outline-offset: 2px; }

/* ---- E-Mail-Vorlagen-Editor ---------------------------------------------- */
.tpl-editor { display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); grid-template-areas: "form side" "preview side"; align-items: start; }
.tpl-editor__form { grid-area: form; }
.tpl-editor__side { grid-area: side; position: sticky; top: var(--space-2); max-height: calc(100vh - 2rem); overflow-y: auto; }
.tpl-editor__preview { grid-area: preview; }
.ph-list { list-style: none; margin: 0 0 var(--space-2); padding: 0; display: grid; gap: .75rem; }
.ph-list li { display: grid; gap: .15rem; }
.ph-insert { justify-self: start; font-family: ui-monospace, monospace; font-size: .85rem; padding: .2rem .5rem; border: 1px solid var(--text-accent); background: var(--bg); color: var(--text-accent); cursor: pointer; border-radius: var(--radius-btn); overflow-wrap: anywhere; text-align: left; }
.ph-insert:hover, .ph-insert:focus-visible { background: var(--text-accent); color: var(--on-red); }
.ph-desc { font-size: var(--fs-small); }
.ph-example { font-size: var(--fs-small); color: var(--text-soft); overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .tpl-editor { grid-template-columns: minmax(0, 1fr); grid-template-areas: "form" "side" "preview"; }
  .tpl-editor__side { position: static; max-height: none; }
}

/* ---- Datensicherung (Verwaltung) ----------------------------------------- */
.backup-status { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.backup-status li { padding: .5rem .75rem; background: var(--bg-section); border-left: 4px solid var(--surface-card); overflow-wrap: anywhere; }
.backup-status--alert { border-left-color: var(--text-accent) !important; }
.regroup-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.regroup-row__from { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; }
.regroup-row input { flex: 0 1 12rem; min-width: 0; }

/* --- Änderungsprotokoll (Live-Ansicht) ------------------------------------------------ */
.protokoll-filter .chips { display: flex; flex-wrap: wrap; gap: .4rem; border: 0; padding: 0; margin: 0 0 var(--space-2); }
.protokoll-filter .chips legend { font-weight: 600; margin-bottom: .3rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .7rem; border: 1.5px solid var(--ah-sand); border-radius: 999px; cursor: pointer; font-size: var(--fs-small); background: var(--ah-white); }
.chip input { accent-color: var(--ah-red); margin: 0; }
.chip--on { border-color: var(--ah-red); background: var(--bg-section); }
.chip__n { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.filterbar .field--wide { min-width: 16rem; flex: 1; }
.protokoll td { vertical-align: top; }
.protokoll .nowrap { white-space: nowrap; }
.protokoll-details summary { cursor: pointer; }
.protokoll-body { padding: var(--space-1) 0 0; }
.protokoll-row--daten { background: color-mix(in srgb, var(--bg-section) 45%, transparent); }
.protokoll-row.is-new { animation: protokoll-neu 6s ease-out; }
@keyframes protokoll-neu { from { background: #fff3c4; } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .protokoll-row.is-new { animation: none; outline: 2px solid var(--ah-gold); } }
.table--compact { font-size: var(--fs-small); margin-bottom: var(--space-1); }
.table--compact td, .table--compact th { padding: .3rem .5rem; }
.badge--cat { font-size: .75rem; white-space: nowrap; }
.live-toggle[aria-pressed="true"] { border-color: var(--ah-red); color: var(--ah-red); }
.live-new { position: sticky; top: .5rem; z-index: 5; display: block; margin: 0 auto var(--space-2); padding: .5rem 1.2rem; border: 0; border-radius: 999px; background: var(--ah-red); color: var(--on-red); font-weight: 600; cursor: pointer; box-shadow: 0 2px 8px rgb(0 0 0 / .2); }

/* --- Kopfzeile: wer ist angemeldet ---------------------------------------------------- */
.userbar { background: var(--ah-ink); color: var(--ah-white); font-size: var(--fs-small); }
.userbar--stiftung { background: #3a2a2a; }
.userbar__inner { display: flex; flex-wrap: wrap; gap: .35rem var(--space-2); align-items: center; justify-content: space-between; padding-block: .45rem; }
/* Die Logo-Box hängt auf breiten Bildschirmen über die Leiste: Text rechts davon beginnen */
@media (min-width: 861px) { .userbar__inner { padding-left: calc(clamp(150px, 18vw, 256px) + var(--space-3)); } }
.userbar__who { margin: 0; line-height: 1.6; }
.userbar__label { opacity: .75; }
.userbar__mail { opacity: .75; }
.userbar__sep { opacity: .5; margin-inline: .35rem; }
.userbar__role { display: inline-block; white-space: nowrap; background: var(--ah-red); color: var(--on-red); padding: .05rem .5rem; border-radius: 999px; }
.mail-counter { display: inline-flex; align-items: center; gap: .4rem; color: inherit; text-decoration: none; padding: .15rem .6rem; border: 1px solid rgb(255 255 255 / .35); border-radius: 999px; white-space: nowrap; }
.mail-counter:hover, .mail-counter:focus-visible { border-color: var(--ah-white); }
.mail-counter__dot { width: .7rem; height: .7rem; border-radius: 50%; background: #3fa34d; }
.mail-counter--gelb .mail-counter__dot { background: #f2b705; }
.mail-counter--rot .mail-counter__dot { background: #ff4d4d; box-shadow: 0 0 0 3px rgb(255 77 77 / .35); }

/* --- E-Mail-Ampel ---------------------------------------------------------------------- */
.mail-ampel { display: flex; gap: .75rem; align-items: center; padding: .6rem .9rem; margin: var(--space-2) 0; border: 1.5px solid var(--ah-sand); background: var(--ah-white); font-size: var(--fs-small); }
.mail-ampel__light { display: inline-flex; flex-direction: column; gap: 3px; padding: 4px; background: #2b2b2b; border-radius: 6px; flex: none; }
.mail-ampel__light i { width: 11px; height: 11px; border-radius: 50%; background: #555; }
.mail-ampel--rot .mail-ampel__light i:nth-child(1) { background: #ff4040; box-shadow: 0 0 6px #ff4040; }
.mail-ampel--gelb .mail-ampel__light i:nth-child(2) { background: #f5c000; box-shadow: 0 0 6px #f5c000; }
.mail-ampel--gruen .mail-ampel__light i:nth-child(3) { background: #36b24a; box-shadow: 0 0 6px #36b24a; }
.mail-ampel--rot { border-color: var(--ah-red); }
.mail-ampel__hint { display: block; margin-top: .2rem; font-weight: 600; }

/* --- Passwort anzeigen ------------------------------------------------------------------ */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 2.8rem; }
.pw-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; border: 0; background: transparent; color: var(--text-soft); cursor: pointer; border-radius: 4px; }
.pw-toggle:hover, .pw-toggle:focus-visible { color: var(--ah-red); }
.pw-toggle:focus-visible { outline: 2px solid var(--ah-red); outline-offset: 1px; }
.pw-toggle[aria-pressed="true"] { color: var(--ah-red); }

/* --- Verlauf der Angaben ----------------------------------------------------------------- */
.snapshot > summary { cursor: pointer; }
mark.changed { background: #fff0b3; padding: 0 .2rem; }

/* --- Reiter (z. B. Benutzer:innen) ------------------------------------------------------ */
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 2px solid var(--ah-sand); margin: 0 0 var(--space-3); }
.tabs a { padding: .5rem .9rem; text-decoration: none; color: var(--ah-ink); border: 2px solid transparent; border-bottom: 0; margin-bottom: -2px; font-weight: 600; }
.tabs a[aria-current="page"] { border-color: var(--ah-sand); background: var(--ah-white); color: var(--ah-red); }
.tabs__n { font-weight: 400; color: var(--text-soft); font-size: var(--fs-small); }
.rights td, .rights th[scope="col"] { text-align: center; }
.rights th[scope="row"] { text-align: left; font-weight: 600; }
.rights__cell { display: inline-flex; padding: .25rem; cursor: pointer; }
.rights__cell input { width: 1.2rem; height: 1.2rem; accent-color: var(--ah-red); }
.org-accounts { margin-top: var(--space-3); }
.org-accounts__title { font-size: 1.15rem; margin-bottom: .4rem; }

/* Unauffälliger Menüpunkt (z. B. „Budget“ für Beratungsstellen): gut auffindbar, nicht dominant */
.ah-nav a.ah-nav__minor { font-weight: 500; opacity: .85; }
.ah-nav a.ah-nav__minor:hover, .ah-nav a.ah-nav__minor[aria-current="page"] { opacity: 1; }

/* Startseite: Hinweis auf die Erklärung weiter unten */
.hero-hint { text-align: center; margin-top: var(--space-2); }
.hero-hint a { display: inline-block; padding: .5rem 1rem; border: 1.5px solid var(--ah-red); border-radius: 999px; font-weight: 600; text-decoration: none; }
.hero-hint a:hover, .hero-hint a:focus-visible { background: var(--ah-red); color: var(--on-red); }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.tile--alert { border: 2px solid var(--ah-red); }

/* --- Zugriffsstatistik ------------------------------------------------------------------- */
.zgr-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.zgr-grid .zgr-wide { grid-column: 1 / -1; }
.chart--tall { height: 20rem; }

/* --- Schalter „Wartungsaktivitäten in Protokoll aufführen“ (Admin) --------------------- */
.userbar__tools { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.wartung-toggle { margin: 0; }
.wartung-toggle button { display: inline-flex; align-items: center; gap: .45rem; background: transparent; color: inherit; font: inherit; font-size: var(--fs-small); border: 1px solid rgb(255 255 255 / .35); border-radius: 999px; padding: .15rem .65rem; cursor: pointer; }
.wartung-toggle button:hover, .wartung-toggle button:focus-visible { border-color: var(--ah-white); }
.wartung-toggle__track { position: relative; width: 2rem; height: 1.1rem; border-radius: 999px; background: #8a8580; flex: none; }
.wartung-toggle__knob { position: absolute; top: .12rem; left: .12rem; width: .86rem; height: .86rem; border-radius: 50%; background: var(--ah-white); }
.wartung-toggle--an .wartung-toggle__track { background: #3fa34d; }
.wartung-toggle--an .wartung-toggle__knob { left: auto; right: .12rem; }
