/* ==========================================================================
   KlH Rechnungsverwaltung — modernes App-Design
   Wird NUR auf den App-Seiten geladen (nicht auf der Login-Seite).
   Reihenfolge: styles.css -> fonts.css -> glass-buttons.css -> app.css
   ========================================================================== */

/* ---------- 1) Grundlagen: Farben, Hintergrund, Schrift ---------- */
:root {
  --bg: #eef2f8;
  --surface-raised: #f3f6fb;
  --border: rgb(16 32 56 / 0.16);
  --border-muted: rgb(16 32 56 / 0.09);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --shadow-card: 0 1px 2px rgb(16 32 56 / 0.05), 0 16px 32px -22px rgb(16 32 56 / 0.4);
  --shadow-pop: 0 24px 48px -20px rgb(16 32 56 / 0.45);
  --ease-ios: cubic-bezier(0.32, 0.72, 0, 1);   /* iOS-typische Bewegungskurve */
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
}

body {
  background-color: var(--bg);
  /* Weiche Farbflächen im Hintergrund: Glas braucht etwas, das durchscheint */
  background-image:
    radial-gradient(900px 520px at 6% -8%, rgb(120 170 255 / 0.3), transparent 62%),
    radial-gradient(820px 480px at 100% 2%, rgb(110 215 195 / 0.24), transparent 58%),
    radial-gradient(900px 620px at 55% 112%, rgb(165 150 255 / 0.18), transparent 60%);
  background-attachment: fixed;
  font-feature-settings: "cv11" 1, "ss03" 1;
  text-rendering: optimizeLegibility;
}
html { scroll-behavior: smooth; }

/* Zahlen in Rechnungs-Optik (Schreibmaschine / Kassenbon) */
.tabular {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.page-title { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.page-toolbar { margin-bottom: 26px; }
.page-toolbar-text p.text-xs { font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.section-label { font-size: 12px; letter-spacing: 0.08em; color: var(--text-muted); margin: 0 4px 12px; }
.container { max-width: 880px; }

/* ---------- 2) Kopfleiste: Glas, bleibt beim Scrollen oben ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: rgb(255 255 255 / 0.72);
  -webkit-backdrop-filter: blur(22px) saturate(1.8);
  backdrop-filter: blur(22px) saturate(1.8);
  border-bottom: 1px solid rgb(16 32 56 / 0.1);
}
.navbar-logo { border-radius: 9px; box-shadow: 0 2px 8px -2px rgb(16 32 56 / 0.3); }
.navbar-brand-text { font-weight: 650; letter-spacing: -0.015em; }

@media (max-width: 560px) {
  .navbar-inner { flex-wrap: wrap; row-gap: 10px; column-gap: 12px; padding: 12px 16px; }
  .navbar-actions { order: 1; margin-left: auto; }
  .navbar-nav { order: 2; flex: 1 1 100%; }
  .navbar-link { white-space: nowrap; }
}

/* ---------- 3) Eingabefelder im Glas-Stil ---------- */
.input, textarea.input {
  background-color: rgb(255 255 255 / 0.7);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  backdrop-filter: blur(10px) saturate(1.4);
  border: 1px solid rgb(16 32 56 / 0.5);
  border-radius: 14px;
  padding: 11px 14px;
  box-shadow: inset 0 1px 2px rgb(16 32 56 / 0.06), 0 1px 0 rgb(255 255 255 / 0.8);
  transition: border-color 0.25s var(--ease-ios), box-shadow 0.3s var(--ease-ios), background-color 0.25s ease;
}
.input:hover, textarea.input:hover { border-color: rgb(16 32 56 / 0.68); }
.input:focus, textarea.input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgb(19 96 159 / 0.18), inset 0 1px 2px rgb(16 32 56 / 0.04);
}
.field-label { font-weight: 600; letter-spacing: -0.005em; }

/* ---------- 4) Karten und Status-Plaketten ---------- */
.card {
  border-radius: 20px;
  border: 1px solid rgb(16 32 56 / 0.08);
  border-left-width: 4px;
  box-shadow: var(--shadow-card);
  transition: transform 0.45s var(--ease-ios), box-shadow 0.45s var(--ease-ios), background-color 0.25s ease, border-color 0.25s ease;
}
a.card:hover { transform: translateY(-3px); box-shadow: 0 22px 40px -22px rgb(16 32 56 / 0.5); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 11px 4px 9px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- 5) Übersicht (Startseite) ---------- */
.summary { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 14px; margin-bottom: 26px; }
.tile {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 18px 20px 16px;
  background: rgb(255 255 255 / 0.7);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid rgb(255 255 255 / 0.9);
  box-shadow: var(--shadow-card), inset 0 1px 0 #fff;
}
.tile-label { margin: 0; font-size: 12px; font-weight: 650; color: var(--text-muted); }
.tile-value { margin: 8px 0 4px; font-size: 28px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-sub { margin: 0; font-size: 12px; color: var(--text-muted); }
/* Hervorgehobene erste Kachel: dunkles Glas */
.tile-hero {
  background: linear-gradient(155deg, rgb(24 58 108 / 0.96), rgb(14 36 74 / 0.96));
  border-color: rgb(255 255 255 / 0.16);
  box-shadow: 0 22px 40px -24px rgb(8 24 52 / 0.7), inset 0 1px 0 rgb(255 255 255 / 0.24);
  color: #ffffff;
}
.tile-hero::after {
  content: "";
  position: absolute;
  right: -40px; top: -60px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(120 170 255 / 0.4), transparent 70%);
  pointer-events: none;
}
.tile-hero .tile-label, .tile-hero .tile-sub { color: rgb(255 255 255 / 0.72); }
.tile-warn .tile-value { color: var(--status-einspruch); }

.overview-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 26px; }
.overview-search { flex: 1 1 280px; min-width: 0; }
.overview-search .lg-input { width: 100%; }
.overview-filter { flex: none; }
.overview-filter .lg-segmented { --lg-tab-width: 84px; --lg-tab-height: 36px; }
.overview-filter .lg-segmented :is(.lg-tab, .lg-tab-copy) { font-size: 13px; font-family: inherit; }
.overview-info { margin: -10px 4px 18px; font-size: 12.5px; color: var(--text-muted); min-height: 1.2em; }

/* Offene Rechnungen: große "Tickets" mit Perforation */
.ticket-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.ticket {
  --ticket-accent: var(--border-strong);
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 22px 0;
  background: #ffffff;
  border-radius: 22px;
  border: 1px solid rgb(16 32 56 / 0.07);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.5s var(--ease-ios), box-shadow 0.5s var(--ease-ios);
}
.ticket::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--ticket-accent); }
.ticket:hover { transform: translateY(-4px); box-shadow: 0 26px 44px -24px rgb(16 32 56 / 0.55); }
.ticket-offen { --ticket-accent: linear-gradient(90deg, #f2b53a, #f08a1c); }
.ticket-zur_pruefung { --ticket-accent: linear-gradient(90deg, #4f7be0, #2f56c0); }
.ticket-im_einspruch { --ticket-accent: linear-gradient(90deg, #e2574c, #b8302a); }
.ticket-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ticket-no { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.02em; color: var(--text-muted); }
.ticket-amount { margin: 16px 0 4px; font-size: 32px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ticket-sub { margin: 0 0 20px; font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-perf { position: relative; margin: 0 -22px; border-top: 2px dashed rgb(16 32 56 / 0.18); }
.ticket-perf::before, .ticket-perf::after {
  content: ""; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--bg);
  box-shadow: inset 0 1px 3px rgb(16 32 56 / 0.12);
}
.ticket-perf::before { left: -11px; }
.ticket-perf::after { right: -11px; }
.ticket-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 0 17px; font-size: 12.5px; }
.ticket-due { font-weight: 600; color: var(--text-secondary); }
.ticket-due.due-soon { color: var(--status-offen); }
.ticket-due.due-overdue { color: var(--status-einspruch); }
.ticket-go { font-weight: 650; color: var(--accent-strong); transition: transform 0.4s var(--ease-ios); }
.ticket:hover .ticket-go { transform: translateX(3px); }

/* Verlauf: kleine Belege mit gezacktem Rand, nach Monat gruppiert */
.receipt-group { margin-bottom: 30px; }
.receipt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 4px 16px; padding-bottom: 10px; border-bottom: 1px solid rgb(16 32 56 / 0.12); }
.receipt-month { margin: 0; white-space: nowrap; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.receipt-sum { margin: 0; font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; }
/* Der Schatten liegt auf dem Raster, weil die Maske der Belege ihren eigenen Schatten abschneiden würde */
.receipt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 18px;
  filter: drop-shadow(0 1px 1px rgb(16 32 56 / 0.13)) drop-shadow(0 14px 14px rgb(16 32 56 / 0.1));
}
.receipt {
  --state: #66758a;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 160px;
  padding: 16px 18px 26px;
  background: #fffdf9;
  color: #1a2433;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 7px) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 7px repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 7px) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 7px repeat-x;
  transition: transform 0.55s var(--ease-ios);
}
.receipt:hover { transform: translateY(-5px) rotate(-0.5deg); }
.receipt.is-bezahlt { --state: #168a50; }
.receipt.is-storniert { --state: #66758a; }
.receipt-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.receipt-no { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; letter-spacing: 0.02em; color: #3a4a5e; }
.receipt-state { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--state); }
.receipt-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.receipt-items {
  margin: 12px 0 auto;
  padding-bottom: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #2a3a4e;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.receipt-foot { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px dashed rgb(26 36 51 / 0.3); }
.receipt-amount { font-family: var(--font-mono); font-size: 19px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.receipt-date { font-size: 11.5px; color: #6a7a8e; white-space: nowrap; }
.receipt.is-storniert .receipt-amount { text-decoration: line-through; color: #6a7a8e; }
/* Status als Stempel im Hintergrund */
.receipt::after {
  content: attr(data-stamp);
  position: absolute;
  right: 12px;
  top: 40px;
  transform: rotate(-9deg);
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--state);
  opacity: 0.11;
  pointer-events: none;
  white-space: nowrap;
}
.empty-state { margin: 8px 4px 0; padding: 28px 20px; text-align: center; font-size: 14px; color: var(--text-muted); background: rgb(255 255 255 / 0.55); border: 1px dashed rgb(16 32 56 / 0.22); border-radius: 22px; }

/* ---------- 6) Die Rechnung selbst: Blatt mit Briefkopf ---------- */
.invoice-sheet {
  --paper: #fffdf9;
  --ink: #1a2433;
  --stamp: #8795a6;
  position: relative;
  padding: 44px 48px 28px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 6px 6px 0 0;
  box-shadow: 0 1px 2px rgb(16 32 56 / 0.08), 0 30px 60px -30px rgb(16 32 56 / 0.55);
  overflow: hidden;
}
/* Gezackter Rand unten, wie ein abgerissener Beleg. Der Schatten liegt auf dem Wrapper (#detail),
   weil eine Maske den eigenen Schatten abschneiden würde. */
.invoice-sheet {
  padding-bottom: 40px;
  box-shadow: none;
  border-radius: 6px 6px 0 0;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 9px) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 18px 9px repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 9px) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 18px 9px repeat-x;
}
#detail:has(.invoice-sheet) {
  filter: drop-shadow(0 1px 1px rgb(16 32 56 / 0.14)) drop-shadow(0 28px 28px rgb(16 32 56 / 0.2));
  margin-bottom: 20px;
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 2px solid var(--ink); }
.sheet-brand { display: flex; align-items: center; gap: 14px; }
.sheet-logo { width: 46px; height: 46px; border-radius: 11px; }
.sheet-org { margin: 0; font-family: var(--font-serif); font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.sheet-org-sub { margin: 3px 0 0; font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: #5a6b80; }
.sheet-title { text-align: right; }
.sheet-title h1 { margin: 0; font-family: var(--font-serif); font-size: 30px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; line-height: 1; }
.sheet-no { margin: 8px 0 0; display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: #3a4a5e; }

.sheet-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 24px 0 8px; }
.sheet-label { display: block; margin: 0 0 5px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #6a7a8e; }
.sheet-value { margin: 0; font-size: 14.5px; font-weight: 500; }
.sheet-value.mono { font-family: var(--font-mono); font-size: 14px; }
.sheet-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 22px 0 26px; padding: 18px 20px; background: rgb(26 36 51 / 0.035); border-radius: 10px; }

.sheet-items { width: 100%; border-collapse: collapse; }
.sheet-items th { padding: 0 0 9px; text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #6a7a8e; border-bottom: 1px solid rgb(26 36 51 / 0.35); background: none; }
.sheet-items td { padding: 12px 0; font-size: 14.5px; border-bottom: 1px dotted rgb(26 36 51 / 0.28); background: none; }
.sheet-items tbody tr:hover { background: none; }
.sheet-items .pos { width: 44px; font-family: var(--font-mono); font-size: 12.5px; color: #6a7a8e; }
.sheet-items .amt, .sheet-items th.amt { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

.sheet-totals { margin: 18px 0 0 auto; width: min(100%, 320px); }
.sheet-totals .row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 6px 0; font-size: 14px; color: #3a4a5e; }
.sheet-totals .row .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.sheet-totals .grand { margin-top: 8px; padding: 12px 0 0; border-top: 2px solid var(--ink); font-size: 16px; font-weight: 700; color: var(--ink); }
.sheet-totals .grand .v { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; border-bottom: 3px double var(--ink); padding-bottom: 2px; }

.sheet-section { margin-top: 26px; padding-top: 18px; border-top: 1px solid rgb(26 36 51 / 0.16); }
.sheet-section .sheet-value { font-size: 14px; line-height: 1.6; color: #2a3a4e; }
.sheet-section a.link-accent { font-size: 13px; }
.sheet-foot { margin-top: 30px; padding-top: 14px; border-top: 1px dashed rgb(26 36 51 / 0.3); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #6a7a8e; }

/* Stempel für den Status */
.sheet-stamp {
  position: absolute;
  top: 134px; right: 44px;
  padding: 6px 16px 5px;
  border: 3px double var(--stamp);
  border-radius: 8px;
  color: var(--stamp);
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: rotate(-9deg);
  opacity: 0.85;
  pointer-events: none;
  animation: stamp-in 0.7s var(--ease-ios) 0.25s backwards;
}
.status-offen { --stamp: #c27a10; } .status-zur_pruefung { --stamp: #2f56c0; } .status-bezahlt { --stamp: #168a50; }
.status-im_einspruch { --stamp: #b8302a; } .status-storniert { --stamp: #66758a; }
@keyframes stamp-in { from { opacity: 0; transform: rotate(-9deg) scale(1.6); } to { opacity: 0.85; transform: rotate(-9deg) scale(1); } }

@media (max-width: 640px) {
  .receipt-head { flex-direction: column; align-items: flex-start; gap: 3px; }
  .receipt-sum { text-align: left; }
  .invoice-sheet { padding: 28px 22px 22px; }
  .sheet-head { flex-direction: column; gap: 16px; }
  .sheet-title { text-align: left; }
  .sheet-meta, .sheet-parties { grid-template-columns: 1fr 1fr; }
  .sheet-stamp { top: 138px; right: 14px; font-size: 14px; padding: 4px 10px 3px; }
  .summary { grid-template-columns: 1fr; }
  .page-title { font-size: 26px; }
}
@media (max-width: 920px) and (min-width: 641px) { .summary { grid-template-columns: 1fr 1fr; } .summary .tile-hero { grid-column: 1 / -1; } }

/* ---------- 7) Mitarbeiter-Portal: Tabelle und Filterleiste ---------- */
.filter-bar { gap: 14px; margin-bottom: 18px; }
.search-input { border-radius: 999px; }
.portal-search { flex: 0 1 380px; min-width: 240px; }
.portal-search .lg-input { width: 100%; }
.table-wrap { background: #ffffff; border: 1px solid rgb(16 32 56 / 0.07); border-radius: 22px; box-shadow: var(--shadow-card); overflow: hidden; }
thead tr { background: transparent; }
th { font-size: 11px; letter-spacing: 0.08em; padding-top: 16px; padding-bottom: 12px; }
td { padding-top: 15px; padding-bottom: 15px; }
tbody tr { transition: background-color 0.25s ease; }
tbody tr:hover { background-color: #f4f8fe; }

/* ---------- 8) Bewegung: weich wie auf iOS ---------- */
@keyframes klh-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes klh-rise { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
#content { animation: klh-fade 0.45s ease backwards; }
.summary > *, .ticket-grid > *, .receipt-group, .overview-controls, .invoice-sheet, .stack > .card {
  animation: klh-rise 0.65s var(--ease-ios) backwards;
}
.summary > :nth-child(2), .ticket-grid > :nth-child(2) { animation-delay: 0.05s; }
.summary > :nth-child(3), .ticket-grid > :nth-child(3) { animation-delay: 0.1s; }
.ticket-grid > :nth-child(4) { animation-delay: 0.15s; }
.ticket-grid > :nth-child(n + 5) { animation-delay: 0.2s; }
.receipt { animation: klh-rise 0.65s var(--ease-ios) backwards; }
.receipt-group:nth-of-type(2) { animation-delay: 0.08s; }
.receipt-group:nth-of-type(n + 3) { animation-delay: 0.14s; }
.receipt-grid > :nth-child(2) { animation-delay: 0.04s; }
.receipt-grid > :nth-child(3) { animation-delay: 0.08s; }
.receipt-grid > :nth-child(n + 4) { animation-delay: 0.12s; }

/* Seitenwechsel: weiches Überblenden, die Kopfleiste (mit Slider) bleibt stehen */
@view-transition { navigation: auto; }
.navbar { view-transition-name: klh-navbar; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.28s; animation-timing-function: var(--ease-ios); }

/* ---------- 10) Gehaltsrechner ---------- */
.calc { max-width: 680px; }
.calc-card {
  position: relative;
  z-index: 2;   /* damit das geöffnete Dropdown über der Ergebniskarte liegt */
  padding: 26px 26px 22px;
  background: rgb(255 255 255 / 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid rgb(255 255 255 / 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow-card), inset 0 1px 0 #fff;
}
.calc-heading { margin: 0 0 18px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.calc-field { margin-bottom: 20px; }
.calc-field:last-child { margin-bottom: 0; }
.calc-field .field-label { display: block; margin-bottom: 8px; }
.calc-hint { margin: 8px 4px 0; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); min-height: 1.2em; }
.calc-hint.is-ok { color: var(--status-bezahlt); font-weight: 600; }
.calc-hint.is-error { color: var(--status-einspruch); }

/* Dropdown mit Suche */
.combo { position: relative; }
.combo-field { position: relative; }
.combo-input { padding-right: 46px; cursor: text; }
.combo-toggle {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  display: grid; place-items: center; width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-secondary); cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.combo-toggle:hover { background: rgb(16 32 56 / 0.07); }
.combo-toggle svg { transition: transform 0.4s var(--ease-ios); }
.combo.is-open .combo-toggle svg { transform: rotate(180deg); }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 8px);
  margin: 0; padding: 8px; list-style: none;
  max-height: 340px; overflow-y: auto; overscroll-behavior: contain;
  background: rgb(255 255 255 / 0.98);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid rgb(16 32 56 / 0.12);
  border-radius: 20px;
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.9) inset, 0 28px 50px -22px rgb(16 32 56 / 0.55);
  transform-origin: top center;
  animation: combo-in 0.28s var(--ease-ios);
}
.combo-list[hidden] { display: none; }
@keyframes combo-in { from { opacity: 0; transform: translateY(-6px) scale(0.97); } to { opacity: 1; transform: none; } }
.combo-group { padding: 10px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.combo-option {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 12px; border-radius: 13px; cursor: pointer;
  transition: background-color 0.18s ease;
}
.combo-option.is-active { background: rgb(19 96 159 / 0.1); }
.combo-option[aria-selected="true"] .combo-name { color: var(--accent-strong); }
.combo-option[aria-selected="true"]::after { content: "✓"; order: 3; color: var(--accent-strong); font-weight: 700; }
.combo-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.combo-name { font-size: 14.5px; font-weight: 600; }
.combo-req { margin-top: 1px; font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-rate { flex: none; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.combo-rate.is-none { font-family: inherit; font-style: italic; color: var(--text-muted); }
.combo-empty { padding: 18px 12px; text-align: center; font-size: 13.5px; color: var(--text-muted); }

/* Ergebnis */
.calc-result {
  position: relative; z-index: 1; overflow: hidden; margin-top: 18px; padding: 24px 26px 22px;
  border-radius: 24px; color: #fff;
  background: linear-gradient(155deg, rgb(24 58 108 / 0.97), rgb(14 36 74 / 0.97));
  border: 1px solid rgb(255 255 255 / 0.16);
  box-shadow: 0 26px 46px -26px rgb(8 24 52 / 0.75), inset 0 1px 0 rgb(255 255 255 / 0.24);
}
.calc-result::after { content: ""; position: absolute; right: -50px; top: -70px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgb(120 170 255 / 0.42), transparent 70%); pointer-events: none; }
.calc-result .tile-label { color: rgb(255 255 255 / 0.72); }
.calc-result-value { margin: 10px 0 6px; font-size: clamp(34px, 7vw, 52px); font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; font-variant-numeric: tabular-nums; position: relative; z-index: 1; word-break: break-word; }
.calc-result-value.is-empty { color: rgb(255 255 255 / 0.4); }
.calc-result-value.is-updated { animation: result-pop 0.5s var(--ease-ios); }
@keyframes result-pop { from { opacity: 0.4; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
.calc-result-sub { margin: 0; font-size: 13.5px; color: rgb(255 255 255 / 0.78); position: relative; z-index: 1; }
.calc-result-actions { margin-top: 16px; position: relative; z-index: 1; }
.calc-result-actions:empty, .calc-result-actions:has(> [hidden]:only-child) { margin-top: 0; }
.calc-result .btn-outline { --lg-glass: rgb(255 255 255 / 0.16); --lg-glass-active: rgb(255 255 255 / 0.26); --lg-foreground: #fff; color: #fff; box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3), inset 0 0 0 0.5px rgb(255 255 255 / 0.3); }
.calc .calc-card, .calc .calc-result { animation: klh-rise 0.65s var(--ease-ios) backwards; }
.calc .calc-result { animation-delay: 0.08s; }

@media (max-width: 560px) {
  .calc-card { padding: 20px 18px 18px; border-radius: 22px; }
  .calc-result { padding: 20px 18px; border-radius: 22px; }
  .combo-req { display: none; }
}
@media (prefers-reduced-motion: reduce) { .combo-list, .calc-result-value.is-updated, .calc .calc-card, .calc .calc-result { animation: none; } }

/* ---------- 9) Drucken: nur das Rechnungsblatt ---------- */
@media print {
  body { background: #ffffff !important; }
  .navbar, .back-link, .site-footer, #review-container, #proof-form-container, .copy-btn, .btn, .sheet-foot .no-print { display: none !important; }
  .container { max-width: none; padding: 0; }
  .invoice-sheet { box-shadow: none; padding: 0; border-radius: 0; animation: none; -webkit-mask: none; mask: none; }
  #detail:has(.invoice-sheet) { filter: none; }
  .sheet-stamp { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #content, .summary > *, .ticket-grid > *, .receipt-group, .overview-controls, .invoice-sheet, .stack > .card, .sheet-stamp { animation: none; }
  .ticket:hover, a.card:hover { transform: none; }
  @view-transition { navigation: none; }
}
