/* =====================================================================
   DigitalAbo v3 – Gestaltung Kundenportal & Verwaltung
   Lokal gehostete Schrift (Source Serif 4, SIL OFL) – keine Drittanbieter.
   ===================================================================== */

@font-face {
  font-family: 'Source Serif 4';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url(../fonts/source-serif-4-latin-opsz-normal.woff2) format('woff2-variations');
  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: 'Source Serif 4';
  font-style: normal;
  font-display: swap;
  font-weight: 200 900;
  src: url(../fonts/source-serif-4-latin-ext-opsz-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  --accent: #0E6A7B;
  --on-accent: #fff;
  --accent-rgb: 14,106,123;
  --ink: #1C2733;
  --ink-2: #3A4552;
  --muted: #5E6873;
  --paper: #F2F3F0;
  --surface: #FFFFFF;
  --line: #DCDFDB;
  --line-2: #E9EBE8;
  --ok: #2F7D4F;
  --warn: #9A5F0C;
  --bad: #B42318;
  --info: #2B5D9B;
  --radius: 6px;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --accent-soft: rgba(var(--accent-rgb), .09);
  --accent-line: rgba(var(--accent-rgb), .28);

  --bs-body-font-family: var(--sans);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--line);
  --bs-link-color: var(--accent);
  --bs-link-color-rgb: var(--accent-rgb);
  --bs-link-hover-color: var(--ink);
  --bs-primary: var(--accent);
  --bs-primary-rgb: var(--accent-rgb);
  --bs-border-radius: var(--radius);
  --bs-focus-ring-color: rgba(var(--accent-rgb), .3);
}

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, .serif { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
a { text-underline-offset: .18em; }
:focus-visible { outline: 3px solid rgba(var(--accent-rgb), .45); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 2000; border-radius: var(--radius); }
.skip-link:focus { left: 8px; }
.text-muted { color: var(--muted) !important; }
.small-print { font-size: .82rem; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.nowrap { white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn { --bs-btn-font-weight: 500; border-radius: var(--radius); }
.btn-accent, .btn-primary {
  --bs-btn-color: var(--on-accent); --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: var(--on-accent); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent);
  --bs-btn-active-color: var(--on-accent); --bs-btn-active-bg: var(--accent); --bs-btn-active-border-color: var(--accent);
  --bs-btn-disabled-color: var(--on-accent); --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent);
}
.btn-accent:hover, .btn-primary:hover { filter: brightness(.92); }
.btn-outline-accent {
  --bs-btn-color: var(--accent); --bs-btn-border-color: var(--accent-line);
  --bs-btn-hover-color: var(--accent); --bs-btn-hover-bg: var(--accent-soft); --bs-btn-hover-border-color: var(--accent);
  --bs-btn-active-color: var(--accent); --bs-btn-active-bg: var(--accent-soft); --bs-btn-active-border-color: var(--accent);
}
.btn-quiet { --bs-btn-color: var(--ink-2); --bs-btn-hover-bg: rgba(0,0,0,.05); --bs-btn-hover-color: var(--ink); border: 0; }
.btn-lg { --bs-btn-padding-y: .7rem; --bs-btn-padding-x: 1.4rem; --bs-btn-font-size: 1.05rem; }

/* ---------- Formulare ---------- */
.form-control, .form-select { border-color: var(--line); border-radius: var(--radius); }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .18); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(var(--accent-rgb), .18); border-color: var(--accent); }
.form-label { font-weight: 500; font-size: .92rem; margin-bottom: .3rem; }
.form-text { color: var(--muted); }
fieldset[disabled] .form-control, .form-control:disabled, .form-select:disabled { background: var(--paper); color: var(--ink); opacity: 1; border-color: var(--line-2); }

/* ---------- Status-Pillen ---------- */
.pill { display: inline-flex; align-items: center; gap: .3em; padding: .12em .6em; border-radius: 999px; font-size: .78rem; font-weight: 600; line-height: 1.5; white-space: nowrap; border: 1px solid transparent; }
.pill i { font-size: .9em; }
.pill-ok    { color: var(--ok);   background: rgba(47,125,79,.1); border-color: rgba(47,125,79,.22); }
.pill-warn  { color: var(--warn); background: rgba(154,95,12,.1); border-color: rgba(154,95,12,.25); }
.pill-bad   { color: var(--bad);  background: rgba(180,35,24,.08); border-color: rgba(180,35,24,.22); }
.pill-info  { color: var(--info); background: rgba(43,93,155,.09); border-color: rgba(43,93,155,.22); }
.pill-muted { color: var(--muted); background: rgba(0,0,0,.04); border-color: var(--line); }
.pill-accent{ color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }

/* ---------- Flash ---------- */
.flash-stack .alert { border-radius: var(--radius); border-width: 0 0 0 4px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.alert-success { border-color: var(--ok); }
.alert-danger  { border-color: var(--bad); }
.alert-warning { border-color: var(--warn); }
.alert-info    { border-color: var(--info); }

/* ---------- Panels (statt Karten-Einheitsbrei: nur wo Gruppierung nötig) ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--line-2); }
.panel-head h2, .panel-head h3 { font-size: 1.08rem; margin: 0; }
.panel-body { padding: 1.1rem; }
.panel-foot { padding: .7rem 1.1rem; border-top: 1px solid var(--line-2); font-size: .85rem; color: var(--muted); }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2rem; display: block; margin-bottom: .6rem; color: var(--line); }
.empty-state p { max-width: 42ch; margin: 0 auto 1rem; }

/* =====================================================================
   Kundenportal
   ===================================================================== */
body.portal, body.auth { font-size: 1rem; }
.container-narrow { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.site-header { background: var(--surface); border-top: 4px solid var(--accent); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 1rem; }
.brand { text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; }
.brand-name { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; letter-spacing: -.015em; }
.brand-logo { max-height: 40px; max-width: 220px; }
.header-user { display: flex; align-items: center; gap: .5rem; }
.header-name { color: var(--muted); font-size: .9rem; }

.portal-nav { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.portal-nav::-webkit-scrollbar { display: none; }
.portal-nav a { display: inline-flex; align-items: center; gap: .45rem; padding: .7rem .85rem; color: var(--ink-2); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; font-weight: 500; font-size: .95rem; }
.portal-nav a:hover { color: var(--ink); background: rgba(0,0,0,.025); }
.portal-nav a.active { color: var(--ink); border-bottom-color: var(--accent); }
.portal-nav a i { color: var(--muted); }
.portal-nav a.active i { color: var(--accent); }

.portal-main { padding-top: 2rem; padding-bottom: 3rem; min-height: 60vh; }
.section-title { font-size: 1.5rem; margin: 0 0 1rem; }
.lead-text { color: var(--ink-2); max-width: 62ch; }

/* --- Titelbilder (Umschläge) --- */
.cover { position: relative; aspect-ratio: 3 / 4; border-radius: 3px; overflow: hidden; background: var(--line-2);
         box-shadow: 0 1px 1px rgba(0,0,0,.08), 0 8px 18px -10px rgba(20,32,43,.45); }
.cover-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-type { background: color-mix(in oklab, var(--accent) var(--mix, 100%), #14202b); color: #fff;
              display: flex; flex-direction: column; padding: 9% 9% 8%; }
.cover-type::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.18), rgba(255,255,255,.06) 6%, rgba(0,0,0,0) 12%); pointer-events: none; }
.cover-brand { font-family: var(--serif); font-weight: 700; font-size: 1.05em; letter-spacing: .02em; border-bottom: 1px solid rgba(255,255,255,.45); padding-bottom: .35em; }
.cover-month { font-family: var(--serif); font-weight: 600; font-size: 1.9em; line-height: 1; margin-top: auto; letter-spacing: -.02em; overflow-wrap: anywhere; }
.cover-year { font-family: var(--serif); font-weight: 300; font-size: 1.6em; line-height: 1.1; opacity: .85; }
.cover-hero { width: 100%; font-size: clamp(16px, 2.6vw, 24px); }
.cover-shelf { font-size: clamp(11px, 1.3vw, 14px); }
.cover-thumb { width: 40px; font-size: 9px; border-radius: 2px; flex-shrink: 0; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.cover-thumb.cover-type { padding: 5px 4px; justify-content: flex-end; }
.cover-thumb .cover-brand, .cover-thumb .cover-year { display: none; }
.cover-thumb .cover-month { font-size: 1.25em; letter-spacing: 0; }

/* --- Neueste Ausgabe --- */
.issue-hero { display: grid; grid-template-columns: minmax(150px, 260px) 1fr; gap: clamp(1.25rem, 4vw, 3rem); align-items: center; margin-bottom: 3rem; }
.issue-hero-label { color: var(--accent); font-weight: 600; font-size: .95rem; margin-bottom: .4rem; }
.issue-hero h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); line-height: 1.05; margin: 0 0 .8rem; font-weight: 600; font-variation-settings: "opsz" 60; }
.issue-hero-meta { display: flex; flex-wrap: wrap; gap: .35rem 1.25rem; color: var(--muted); font-size: .95rem; margin-bottom: 1rem; }
.issue-hero-meta span { display: inline-flex; gap: .4rem; align-items: center; }
.issue-hero-desc { max-width: 58ch; color: var(--ink-2); margin-bottom: 1.4rem; font-family: var(--serif); font-size: 1.12rem; line-height: 1.6; }
.issue-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; }
.issue-hero-status { color: var(--muted); font-size: .9rem; }
.issue-hero-status .bi-check2-circle { color: var(--ok); }
@media (max-width: 575px) {
  .issue-hero { grid-template-columns: 110px 1fr; align-items: start; gap: 1rem; }
  .issue-hero h1 { font-size: 1.6rem; }
  .issue-hero-desc { display: none; }
  .issue-hero-actions { grid-column: 1 / -1; }
  .issue-hero-actions .btn { width: 100%; }
}

/* --- Archiv / Regal --- */
.archive-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .75rem 1rem; border-top: 1px solid var(--line); padding-top: 1.5rem; margin-bottom: 1.25rem; }
.archive-head h2 { font-size: 1.4rem; margin: 0; }
.year-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.year-chips a { padding: .3rem .8rem; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink-2); font-size: .9rem; background: var(--surface); }
.year-chips a:hover { border-color: var(--accent-line); }
.year-chips a.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2rem 1.5rem; list-style: none; padding: 0; margin: 0; }
.shelf-item a.shelf-link { text-decoration: none; color: inherit; display: block; }
.shelf-item a.shelf-link:hover .cover { transform: translateY(-3px); box-shadow: 0 1px 1px rgba(0,0,0,.08), 0 14px 24px -12px rgba(20,32,43,.5); }
.shelf-item .cover { transition: transform .18s ease, box-shadow .18s ease; }
.shelf-title { font-family: var(--serif); font-weight: 600; font-size: 1.02rem; line-height: 1.25; margin: .7rem 0 .15rem; }
.shelf-meta { font-size: .82rem; color: var(--muted); display: flex; justify-content: space-between; gap: .5rem; }
.shelf-done { color: var(--ok); }
@media (max-width: 575px) { .shelf { grid-template-columns: repeat(2, 1fr); gap: 1.5rem 1rem; } }
@media (prefers-reduced-motion: reduce) { .shelf-item .cover { transition: none; } .shelf-item a.shelf-link:hover .cover { transform: none; } }

/* --- Abo-Karten --- */
.sub-list { display: grid; gap: 1rem; }
.sub-item { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.sub-item.is-ok { border-left-color: var(--ok); }
.sub-item.is-warn { border-left-color: var(--warn); }
.sub-item h3 { font-size: 1.2rem; margin: 0 0 .35rem; }
.sub-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem 1.5rem; margin: .9rem 0 1rem; }
.sub-facts dt { font-size: .8rem; color: var(--muted); font-weight: 500; }
.sub-facts dd { margin: 0; font-weight: 500; }
.sub-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* --- Definitionsliste --- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
.facts dt { color: var(--muted); font-weight: 500; font-size: .9rem; }
.facts dd { margin: 0; }

/* --- Login / schlichte Seiten --- */
body.auth { background: var(--paper); }
.auth-wrap { min-height: calc(100vh - 70px); display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-intro { background: var(--ink); color: #fff; padding: clamp(2rem, 6vw, 5rem); display: flex; flex-direction: column; justify-content: flex-end;
              background-image: linear-gradient(160deg, rgba(var(--accent-rgb), .55), rgba(var(--accent-rgb), 0) 60%); }
.auth-intro .brand-name { font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1; color: #fff; font-weight: 600; font-variation-settings: "opsz" 60; }
.auth-intro .brand-logo { max-height: 72px; max-width: 320px; background: #fff; padding: 10px 14px; border-radius: var(--radius); }
.auth-sub { font-family: var(--serif); font-size: 1.25rem; opacity: .85; margin: 1rem 0 0; max-width: 30ch; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-title { font-size: 1.8rem; margin: 0 0 .5rem; }
.auth-text { color: var(--ink-2); margin-bottom: 1.5rem; }
.auth-divider { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .85rem; margin: 1.4rem 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.auth-help { margin-top: 1.75rem; font-size: .88rem; color: var(--muted); }
.mail-sent-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 1.6rem; margin-bottom: 1rem; }
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; min-height: auto; }
  .auth-intro { padding: 2rem 1.25rem 1.5rem; }
  .auth-intro .brand-name { font-size: 2.2rem; }
  .auth-sub { font-size: 1.05rem; }
}
.auth-wrap-admin { grid-template-columns: 1fr; min-height: 100vh; background: var(--ink); }
.auth-wrap-admin .auth-card { background: var(--surface); padding: 2rem; border-radius: var(--radius); }
.auth-admin-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: 1.5rem; }
.auth-admin-head .side-portal { color: var(--ink); }
.auth-admin-head .side-tag { color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); padding: 1.25rem 0; font-size: .88rem; color: var(--muted); background: var(--surface); }
.site-footer .container-narrow { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-links a { color: var(--muted); }

/* Kennwort-Stärke / Anzeigen */
.pw-field { position: relative; }
.pw-field .form-control { padding-right: 2.75rem; }
.pw-toggle { position: absolute; right: .35rem; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: .25rem .5rem; }
.pw-meter { height: 4px; background: var(--line-2); border-radius: 2px; margin-top: .4rem; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; background: var(--bad); transition: width .2s, background .2s; }

/* Tabellen */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .65rem .8rem; border-bottom-color: var(--line-2); }
.table thead th { font-size: .8rem; font-weight: 600; color: var(--muted); background: #FAFBF9; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: rgba(var(--accent-rgb), .04); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* =====================================================================
   Verwaltung
   ===================================================================== */
body.admin { font-size: .925rem; background: var(--paper); }
.admin-shell { display: flex; min-height: 100vh; }
.admin-side { width: 236px; flex-shrink: 0; background: var(--ink); color: #c9d1d9; display: flex; flex-direction: column; }
@media (min-width: 992px) { .admin-side { position: sticky; top: 0; height: 100vh; } }
.admin-side.offcanvas-lg { --bs-offcanvas-bg: var(--ink); --bs-offcanvas-width: 260px; background-color: var(--ink) !important; }
.side-brand { display: flex; align-items: baseline; gap: .55rem; padding: 1.25rem 1.25rem 1rem; }
.side-portal { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: #fff; }
.side-tag { font-size: .78rem; color: #8b98a6; }
.side-nav { display: flex; flex-direction: column; padding: .25rem .6rem; gap: 1px; flex: 1; overflow-y: auto; }
.side-nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; color: #c9d1d9; text-decoration: none; border-radius: var(--radius); font-weight: 500; }
.side-nav a i { color: #8b98a6; font-size: 1.05rem; }
.side-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side-nav a.active { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.side-nav a.active i { color: #fff; }
.nav-badge { margin-left: auto; background: var(--accent); color: var(--on-accent); font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; font-weight: 600; }
.side-foot { border-top: 1px solid rgba(255,255,255,.08); padding: .75rem .6rem 1rem; }
.side-user { display: flex; gap: .65rem; align-items: center; color: #fff; text-decoration: none; padding: .5rem .7rem; border-radius: var(--radius); line-height: 1.25; }
.side-user:hover, .side-user.active { background: rgba(255,255,255,.06); color: #fff; }
.side-user > i { font-size: 1.4rem; color: #8b98a6; }
.side-user small { color: #8b98a6; font-size: .78rem; }
.side-logout { width: 100%; text-align: left; background: none; border: 0; color: #8b98a6; padding: .45rem .7rem; border-radius: var(--radius); display: flex; gap: .7rem; align-items: center; }
.side-logout:hover { color: #fff; background: rgba(255,255,255,.06); }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { display: flex; align-items: center; gap: .5rem; background: var(--surface); border-bottom: 1px solid var(--line); padding: .5rem .75rem; position: sticky; top: 0; z-index: 10; }
.admin-content { padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 3rem; max-width: 1360px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.85rem; margin: 0; }
.page-sub { color: var(--muted); margin: .3rem 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Kennzahlen */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; }
.kpi { background: var(--surface); padding: 1rem 1.15rem; }
.kpi-value { font-family: var(--serif); font-size: 2rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.kpi-note { font-size: .78rem; color: var(--muted); margin-top: .35rem; }
.kpi a { color: inherit; text-decoration: none; }
.kpi a:hover .kpi-label { color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .grid-2, .grid-2-even { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 1.25rem; }

/* Filterleiste */
.filterbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filterbar .form-control, .filterbar .form-select { width: auto; min-width: 140px; flex: 0 1 auto; }
.filterbar .search { min-width: 240px; flex: 1; max-width: 360px; }

/* Massenaktionen */
.bulkbar { position: sticky; bottom: 0; z-index: 20; display: none; align-items: center; gap: .75rem; background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: var(--radius); margin-top: 1rem; box-shadow: 0 -6px 18px -8px rgba(0,0,0,.35); flex-wrap: wrap; }
.bulkbar.show { display: flex; }
.bulkbar .btn-light { --bs-btn-font-weight: 600; }

/* Fortschritt */
.progress { --bs-progress-bar-bg: var(--accent); --bs-progress-bg: var(--line-2); height: .7rem; }
.job-progress .progress { height: 1rem; }

/* Balkendiagramme (CSS) */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 6px; height: 160px; padding-top: 1.2rem; }
.bar { position: relative; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; height: calc(var(--h, 0) * 1%); }
.bar.is-muted { background: var(--line); }
.bar-val { position: absolute; top: -1.25rem; left: 50%; transform: translateX(-50%); font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bars-x { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; font-size: .72rem; color: var(--muted); text-align: center; margin-top: .35rem; }
.hbar { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; min-width: 60px; }
.hbar span { display: block; height: 100%; background: var(--accent); width: calc(var(--w, 0) * 1%); border-radius: 4px; }

/* Trichter */
.funnel { display: grid; gap: .65rem; }
.funnel-row { display: grid; grid-template-columns: 11rem 1fr 5.5rem; gap: .75rem; align-items: center; font-size: .9rem; }
.funnel-row .hbar { height: 12px; }
.funnel-row .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 575px) { .funnel-row { grid-template-columns: 1fr 4.5rem; } .funnel-row .hbar { grid-column: 1 / -1; order: 3; } }

/* Kunde: Kopf */
.person-head { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.person-id { display: flex; gap: 1rem; align-items: center; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 1.25rem; flex-shrink: 0; }
.person-meta { display: flex; flex-wrap: wrap; gap: .3rem .9rem; color: var(--muted); font-size: .88rem; }

/* Zeitleiste */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line-2); align-items: start; }
.timeline li:last-child { border-bottom: 0; }
.timeline i { color: var(--muted); }
.timeline .when { color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* Platzhalter-Chips */
.var-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: .4rem 0 .6rem; }
.var-chip { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .76rem; padding: .1rem .45rem; border: 1px dashed var(--accent-line); background: var(--accent-soft); color: var(--accent); border-radius: 4px; cursor: pointer; }
.var-chip:hover { border-style: solid; }

/* Wizard-Schritte */
.steps { display: flex; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; counter-reset: step; list-style: none; padding: 0; }
.steps li { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; }
.steps li::before { counter-increment: step; content: counter(step); width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); font-size: .8rem; font-weight: 600; }
.steps li.done::before { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.steps li.current { color: var(--ink); font-weight: 600; }
.steps li.current::before { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.steps li + li::after { order: -1; content: ""; width: 1.5rem; border-top: 1px solid var(--line); }

/* Auswahlkarten (Ausgaben) */
.pick-list { display: grid; gap: .5rem; }
.pick { display: flex; gap: .9rem; align-items: center; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: inherit; }
.pick:hover { border-color: var(--accent-line); background: rgba(var(--accent-rgb), .03); }
.pick-title { font-weight: 600; }
.pick-meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .2rem .8rem; }

/* Code-Liste (Wiederherstellungscodes) */
.code-grid { display: grid; grid-template-columns: repeat(2, max-content); gap: .4rem 1.5rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1rem; background: var(--paper); padding: 1rem 1.25rem; border-radius: var(--radius); border: 1px dashed var(--line); }
.qr-box { background: #fff; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); display: inline-block; }
.qr-box img, .qr-box canvas { display: block; width: 180px; height: 180px; image-rendering: pixelated; }

.mail-preview { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: var(--radius); background: #eef0ee; }

/* Statuszeilen */
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line-2); align-items: flex-start; }
.check-list li:last-child { border-bottom: 0; }
.check-list .bi-check-circle-fill { color: var(--ok); }
.check-list .bi-exclamation-triangle-fill { color: var(--warn); }
.check-list .bi-x-circle-fill { color: var(--bad); }

@media print {
  .admin-side, .admin-topbar, .page-actions, .bulkbar, .site-header nav, .site-footer { display: none !important; }
}

/* ---------- Feinschliff ---------- */
.check-list.panel-body, .timeline.panel-body { padding: .25rem 1.1rem; }
.nav-underline { --bs-nav-underline-border-width: 3px; --bs-nav-underline-link-active-color: var(--ink); gap: .75rem; }
.nav-underline .nav-link { color: var(--ink-2); }
.nav-underline .nav-link:hover { color: var(--ink); border-bottom-color: var(--line); }
.nav-underline .nav-link.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.list-group { --bs-list-group-active-bg: var(--ink); --bs-list-group-active-border-color: var(--ink); --bs-list-group-border-color: var(--line); }
.list-group-item-action:focus, .list-group-item-action:hover { background: rgba(var(--accent-rgb), .05); }
.tpl-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1400px) { .tpl-grid { grid-template-columns: 1fr 1fr; } }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--accent); border-color: var(--line); box-shadow: 0 8px 24px -10px rgba(20,32,43,.25); }
.text-primary { color: var(--accent) !important; }
.auth-points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .7rem; font-size: 1rem; opacity: .92; max-width: 34ch; }
.auth-points li { display: flex; gap: .7rem; align-items: baseline; }
.auth-points i { color: rgba(255,255,255,.7); }
@media (max-width: 860px) { .auth-points { display: none; } }
@media (max-width: 575px) {
  .portal-nav a { padding: .6rem .55rem; font-size: .9rem; gap: .35rem; }
  .portal-nav a i { display: none; }
  .header-row { min-height: 56px; }
  .brand-name { font-size: 1.25rem; }
}
.modal { --bs-modal-bg: var(--surface); --bs-modal-border-color: var(--line); }
.account-choice { display: grid; gap: .5rem; }
.account-option { display: flex; gap: .75rem; align-items: flex-start; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.account-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.account-option input { margin-top: .2rem; flex-shrink: 0; }
/* Abonnenten: Abos und Laufzeiten, Neu-Hinweis */
.sub-cell { min-width: 260px; }
.sub-line { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .5rem; padding: .15rem 0; }
.sub-line + .sub-line { border-top: 1px dashed var(--line-2); margin-top: .15rem; padding-top: .3rem; }
.sub-name { font-weight: 500; font-size: .88rem; }
.sub-period { flex-basis: 100%; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.sub-period.is-soon { color: var(--warn); font-weight: 600; }
.sub-line.is-over .sub-name { color: var(--muted); }
.nav-badge-inline { display: inline-block; background: var(--accent); color: var(--on-accent); font-size: .72rem; font-weight: 700; padding: .05rem .5rem; border-radius: 999px; margin-left: .2rem; }
.new-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.15rem; margin-bottom: 1rem;
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-left: 4px solid var(--accent); border-radius: var(--radius); }
.new-panel { border-left: 4px solid var(--accent); }
.new-list { list-style: none; margin: 0; padding: 0 1.1rem .5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 1.5rem; }
.new-list li { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; padding: .55rem 0; border-top: 1px solid var(--line-2); }
.new-list a { text-decoration: none; color: inherit; min-width: 0; }
.new-list a:hover .fw-semibold { color: var(--accent); }
