:root {
  --bg: #f3f5f0;
  --sidebar-bg: linear-gradient(180deg, #142219 0%, #1c3324 100%);
  --sidebar-text: #d3dccf;
  --accent: #1d6b42;
  --accent-hover: #155232;
  --accent-grad: linear-gradient(135deg, #1d6b42 0%, #3a9c64 100%);
  --bronze: #b08d57;
  --bronze-dark: #8a6d3f;
  --bronze-light: #e3c793;
  --bronze-grad: linear-gradient(135deg, #9c7a45 0%, #c9a668 100%);
  --card-bg: #ffffff;
  --border: #e4e1d6;
  --text: #23291f;
  --text-muted: #6b6a5c;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #ea580c;
  --yellow: #ca8a04;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(30,30,20,0.05), 0 4px 16px rgba(30,30,20,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(155deg, #eef2ea 0%, #f5f1e6 55%, #eef6ef 100%) fixed;
  color: var(--text);
  font-size: 14px;
}

#app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
#sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 14px; left: 14px; bottom: 14px;
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(15,23,42,0.28);
  z-index: 10;
}
.logo {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}
.logo span { color: var(--bronze-light); }
.logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
}
.logo-row .logo { padding: 0; }
#sidebar-firmenlogo {
  max-height: 30px;
  max-width: 84px;
  border-radius: 6px;
  background: #fff;
  padding: 3px 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
#sidebar-firmenlogo.hidden { display: none; }
#sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; flex: 1; }
.nav-btn {
  background: none;
  border: none;
  color: var(--sidebar-text);
  text-align: left;
  padding: 11px 14px;
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.nav-btn { transition: background 0.15s, transform 0.15s; }
.nav-btn:hover { background: rgba(255,255,255,0.08); transform: translateX(3px); }
.nav-btn.active { background: var(--accent-grad); color: #fff; box-shadow: 0 4px 14px rgba(29,107,66,0.4); }
.sidebar-footer { padding: 16px 18px; font-size: 11px; opacity: 0.5; }

#main {
  margin-left: 248px;
  flex: 1;
  padding: 28px 36px;
  max-width: 1200px;
}

/* ---------- Generic ---------- */
h1 { font-size: 24px; margin-bottom: 4px; }
#main h1 { position: relative; padding-bottom: 10px; }
#main h1::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 44px; height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, #1d6b42, #b08d57);
}
.subtitle { color: var(--text-muted); margin-bottom: 24px; }
h2.section { display: flex; align-items: center; gap: 8px; }
h2.section::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 3px;
  background: linear-gradient(135deg, #1d6b42, #b08d57);
  flex: 0 0 auto;
}
.view-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }

.btn {
  background: var(--accent-grad);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-hover); }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: #f1f5f9; }
.btn.danger { background: #fff; color: var(--red); border: 1px solid var(--border); }
.btn.danger:hover { background: #fef2f2; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn.green { background: var(--green); }
.btn.green:hover { background: #15803d; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s;
}
.card:hover { box-shadow: 0 6px 20px rgba(15,23,42,0.07); }

.onboarding {
  background: linear-gradient(135deg, #16261c 0%, #1f4029 60%, #2f6b45 130%);
  color: #e8eef7;
  border-radius: 16px;
  padding: 34px 34px 28px;
  margin-bottom: 24px;
}
.onboarding h2 { font-size: 22px; color: #fff; margin-bottom: 8px; }
.onboarding p { max-width: 560px; line-height: 1.6; margin-bottom: 18px; opacity: 0.9; }
.onboarding .steps { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; font-size: 14px; }
.onboarding .steps .done { opacity: 0.55; text-decoration: line-through; }

/* ---------- Tables ---------- */
table.list { width: 100%; border-collapse: collapse; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.list th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list tr:last-child td { border-bottom: none; }
table.list tbody tr { cursor: pointer; transition: background 0.1s; }
table.list tbody tr:hover { background: #eff6ff; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty-state { padding: 40px; text-align: center; color: var(--text-muted); background: var(--card-bg); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.grau { background: #f1f5f9; color: #475569; }
.badge.blau { background: linear-gradient(135deg, #ecdfc4, #f7f0df); color: #8a6d3f; }
.badge.gruen { background: linear-gradient(135deg, #dcfce7, #f0fdf4); color: #15803d; }
.badge.rot { background: linear-gradient(135deg, #fee2e2, #fef2f2); color: #b91c1c; }
.badge.orange { background: linear-gradient(135deg, #ffedd5, #fff7ed); color: #c2410c; }
.badge.gelb { background: linear-gradient(135deg, #fef9c3, #fefce8); color: #a16207; }

/* ---------- Dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.15s; position: relative; overflow: hidden; }
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--accent-grad);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(30,30,20,0.1); }
.stat-card .stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-muted); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-hover); }
.stat-card .stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-card.warn { background: linear-gradient(160deg, #fff 55%, #fef2f2 100%); }
.stat-card.warn::before { background: linear-gradient(90deg, #dc2626, #f87171); }
.stat-card.warn .stat-value { color: var(--red); }
.stat-card.good { background: linear-gradient(160deg, #fff 55%, #f0fdf4 100%); }
.stat-card.good::before { background: linear-gradient(90deg, #16a34a, #4ade80); }
.stat-card.good .stat-value { color: var(--green); }
.stat-card.lila, .stat-card.bronze { background: linear-gradient(160deg, #fff 55%, #faf5e8 100%); }
.stat-card.lila::before, .stat-card.bronze::before { background: var(--bronze-grad); }
.stat-card.lila .stat-value, .stat-card.bronze .stat-value { color: var(--bronze-dark); }
.stat-card.blau { background: linear-gradient(160deg, #fff 55%, #f7f3e9 100%); }
.stat-card.blau::before { background: var(--bronze-grad); }
.stat-card.blau .stat-value { color: var(--bronze-dark); }
h2.section { font-size: 16px; margin: 24px 0 12px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29,107,66,0.14);
}
.field .hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.field input.invalid { border-color: var(--red); }

/* ---------- Modal ---------- */
#modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  z-index: 100;
  overflow-y: auto;
}
#modal-backdrop.hidden { display: none; }
#modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  padding: 26px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
#modal.wide { max-width: 980px; }
.modal-title { font-size: 19px; font-weight: 700; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.modal-actions .left { margin-right: auto; }

/* ---------- Positionen-Editor ---------- */
table.pos-editor { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.pos-editor th { font-size: 11px; text-transform: uppercase; color: var(--text-muted); text-align: left; padding: 6px 6px; }
table.pos-editor td { padding: 4px 4px; vertical-align: top; }
table.pos-editor input, table.pos-editor select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}
table.pos-editor .num input { text-align: right; }
.pos-total-row { display: flex; justify-content: flex-end; gap: 30px; padding: 12px 6px 0; font-size: 14px; }
.pos-total-row .totals { text-align: right; min-width: 280px; }
.pos-total-row .totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.pos-total-row .totals .grand { font-weight: 700; font-size: 16px; border-top: 2px solid var(--text); margin-top: 6px; padding-top: 6px; }
.mwst-hinweis { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; text-align: right; }

/* ---------- Dokument-Detail ---------- */
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.doc-meta { color: var(--text-muted); font-size: 13px; line-height: 1.7; }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
table.doc-positionen { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.doc-positionen th { text-align: left; font-size: 12px; color: var(--text-muted); border-bottom: 2px solid var(--border); padding: 8px 6px; }
table.doc-positionen td { padding: 9px 6px; border-bottom: 1px solid var(--border); }
table.doc-positionen .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Toast ---------- */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 500;
  transition: opacity 0.3s;
}
#toast.hidden { opacity: 0; pointer-events: none; }

/* ---------- Startseite / Login ---------- */
#auth-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: linear-gradient(135deg, #0c1610 0%, #16261c 55%, #1f4029 130%);
  overflow-y: auto;
}
.auth-seite {
  position: relative;
  z-index: 1;
  max-width: 1060px;
  margin: 0 auto;
  padding: 24px;
}
.auth-wrap { min-height: calc(100vh - 110px); }
.auth-mehr {
  text-align: center;
  color: #7f95b3;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 0 40px;
  animation: mehr-wippen 2.2s ease-in-out infinite;
}
@keyframes mehr-wippen {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}
.auth-sektion { padding: 34px 0 44px; color: #dbe5f1; }
.auth-sektion h2 { color: #fff; font-size: 24px; margin-bottom: 12px; text-align: center; }
.auth-sektion-intro { max-width: 640px; margin: 0 auto 28px; text-align: center; line-height: 1.7; opacity: 0.85; }
.auth-feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.auth-feature {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 20px;
  transition: transform 0.2s, background 0.2s;
}
.auth-feature:hover { transform: translateY(-3px); background: rgba(255,255,255,0.09); border-color: rgba(96,165,250,0.35); }
.af-icon {
  font-size: 22px;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(29,107,66,0.28), rgba(176,141,87,0.22));
  margin-bottom: 12px;
}
.af-titel { font-weight: 700; color: #fff; margin-bottom: 6px; }
.af-text { font-size: 13.5px; line-height: 1.6; opacity: 0.8; }
/* ---------- Problem/Lösung-Blöcke ---------- */
.auth-probleme { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.ap-karte {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-left: 3px solid var(--bronze-light);
  border-radius: 12px;
  padding: 22px;
  transition: transform 0.2s, background 0.2s;
}
.ap-karte:hover { transform: translateY(-3px); background: rgba(255,255,255,0.08); }
.ap-titel { font-weight: 700; color: #fff; font-size: 16px; margin-bottom: 10px; }
.ap-problem { font-size: 13.5px; line-height: 1.65; opacity: 0.78; margin-bottom: 12px; }
.ap-loesung { font-size: 13.5px; line-height: 1.65; color: #d7ecdf; }
.ap-loesung span { color: #6fcf97; font-weight: 700; margin-right: 4px; }

/* ---------- Preis-Karte ---------- */
.preis-karte {
  max-width: 560px;
  margin: 0 auto;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(176,141,87,0.4);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
}
.preis-titel { font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 10px; }
.preis-text { font-size: 13.5px; line-height: 1.7; opacity: 0.82; margin-bottom: 16px; }
.preis-liste { list-style: none; display: inline-flex; flex-direction: column; gap: 8px; text-align: left; margin: 0 auto 22px; font-size: 13.5px; }
.preis-liste li::before { content: "✓"; color: #6fcf97; font-weight: 700; margin-right: 9px; }

.auth-schritte { max-width: 560px; margin: 20px auto 26px; display: flex; flex-direction: column; gap: 14px; }
.auth-schritte div { display: flex; gap: 14px; align-items: flex-start; line-height: 1.55; }
.auth-schritte span {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.auth-cta { display: block; margin: 0 auto; padding: 12px 28px !important; font-size: 15px !important; }
.auth-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tabs button {
  flex: 1;
  border: none;
  background: none;
  padding: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
}
.auth-tabs button.aktiv { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(15,23,42,0.12); }
.auth-merken {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  cursor: pointer;
}
.auth-merken input { accent-color: var(--accent); }

/* Animierte Hintergrund-Pfade */
.auth-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.auth-bg::before, .auth-bg::after {
  content: "";
  position: absolute;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.28;
  animation: glow-pulsieren 9s ease-in-out infinite alternate;
}
.auth-bg::before {
  background: radial-gradient(circle, #2f8f5b 0%, transparent 70%);
  top: -14vw; left: -10vw;
}
.auth-bg::after {
  background: radial-gradient(circle, #b08d57 0%, transparent 70%);
  bottom: -18vw; right: -12vw;
  animation-delay: -4s;
}
@keyframes glow-pulsieren {
  from { transform: scale(1); opacity: 0.22; }
  to { transform: scale(1.15); opacity: 0.34; }
}
.auth-bg svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.auth-bg svg.gespiegelt { transform: scale(-1, -1); }
.auth-bg path {
  fill: none;
  stroke: #c9a668;
  stroke-linecap: round;
  stroke-dasharray: 260 620;
  animation: pfad-fluss linear infinite, pfad-puls ease-in-out infinite alternate;
}
@keyframes pfad-fluss {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -1760; }
}
@keyframes pfad-puls {
  from { stroke-opacity: 0.04; }
  to { stroke-opacity: 0.22; }
}

/* Titel-Buchstaben schweben herein */
.auth-hero h1 .wort { display: inline-block; white-space: nowrap; margin-right: 0.28em; }
.auth-hero h1 .bst {
  display: inline-block;
  opacity: 0;
  transform: translateY(22px);
  animation: bst-rein 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes bst-rein {
  to { opacity: 1; transform: translateY(0); }
}
.auth-hero, .auth-card { position: relative; z-index: 1; }
.hero-textspalte > p, .auth-hero ul {
  opacity: 0;
  animation: bst-rein 0.9s 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.auth-card {
  opacity: 0;
  transform: translateY(26px);
  animation: bst-rein 0.9s 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 80px rgba(29,107,66,0.25);
}

/* ---------- Hero: Textspalte + Produkt-Mockup ---------- */
.auth-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 36px;
  flex: 2 1 620px;
  max-width: none;
}
.hero-textspalte { flex: 1 1 340px; max-width: 480px; }
.hero-kicker {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #e3c793;
  background: rgba(176,141,87,0.15);
  border: 1px solid rgba(176,141,87,0.35);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
  opacity: 0;
  animation: bst-rein 0.7s 0.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; opacity: 0; animation: bst-rein 0.9s 1.05s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.hero-btn { padding: 12px 22px !important; font-size: 14.5px !important; }
.hero-btn.secondary { background: rgba(255,255,255,0.08) !important; color: #fff !important; border: 1px solid rgba(255,255,255,0.2) !important; }

.hero-mockup {
  flex: 1 1 280px;
  max-width: 320px;
  position: relative;
  opacity: 0;
  transform: translateY(30px) rotate(1.2deg);
  animation: mockup-rein 0.9s 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes mockup-rein { to { opacity: 1; transform: rotate(1.2deg); } }
.hero-mockup-fenster {
  background: #1e293b;
  border-radius: 12px 12px 0 0;
  padding: 9px 12px;
  display: flex;
  gap: 6px;
}
.hero-mockup-fenster span { width: 9px; height: 9px; border-radius: 50%; background: #475569; }
.hero-mockup-fenster span:nth-child(1) { background: #f87171; }
.hero-mockup-fenster span:nth-child(2) { background: #fbbf24; }
.hero-mockup-fenster span:nth-child(3) { background: #4ade80; }
.hero-mockup-inhalt {
  background: #fff;
  border-radius: 0 0 12px 12px;
  padding: 18px 18px 14px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.45);
}
.hm-kopf { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.hm-firma { font-weight: 700; font-size: 13.5px; color: #1e293b; }
.hm-titel { font-size: 11.5px; color: #64748b; margin-bottom: 12px; }
.hm-zeile { display: flex; justify-content: space-between; font-size: 12px; color: #334155; padding: 4px 0; border-bottom: 1px dashed #e2e8f0; }
.hm-zeile.hm-total { font-weight: 700; color: #1e293b; border-bottom: none; border-top: 1.5px solid #1e293b; margin-top: 2px; padding-top: 7px; }
.hm-qr-zeile { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed #cbd5e1; }
.hm-qr { width: 52px; height: 52px; flex: 0 0 auto; }
.hm-qr svg { width: 100%; height: 100%; }
.hm-qr-text { font-size: 10.5px; color: #64748b; line-height: 1.5; }
.hm-qr-text span { color: #16a34a; font-weight: 600; }
.hero-badge-float {
  position: absolute;
  top: -14px; right: -14px;
  background: linear-gradient(135deg, #dc2626, #ef4444);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(220,38,38,0.4);
  transform: rotate(4deg);
}

/* ---------- Kennzahlen-Leiste ---------- */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  max-width: 980px;
  margin: 8px auto 0;
  padding: 22px 10px;
  border-top: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  opacity: 0;
  animation: bst-rein 0.8s 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.hero-stats > div { text-align: center; }
.hero-stats strong { display: block; font-size: 24px; font-weight: 800; color: #fff; }
.hero-stats span { font-size: 12px; color: #93a5c2; }

@media (max-width: 760px) {
  .hero-mockup, .hero-badge-float { display: none; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
}
#auth-screen.hidden { display: none; }
#app.hidden { display: none; }
.auth-wrap {
  display: flex;
  gap: 56px;
  align-items: center;
  max-width: 980px;
  width: 100%;
  flex-wrap: wrap;
  justify-content: center;
}
.auth-hero { flex: 1 1 380px; color: #dbe5f1; max-width: 500px; }
.auth-hero .auth-logo { font-size: 34px; font-weight: 800; color: #fff; letter-spacing: -0.5px; margin-bottom: 18px; }
.auth-hero .auth-logo span { color: #e3c793; }
.auth-hero h1 { font-size: 30px; line-height: 1.25; color: #fff; margin-bottom: 14px; }
.auth-hero p { line-height: 1.65; opacity: 0.85; margin-bottom: 18px; }
.auth-hero ul { list-style: none; display: flex; flex-direction: column; gap: 9px; font-size: 14.5px; }
.auth-hero li::before { content: "✓"; color: #4ade80; font-weight: 700; margin-right: 9px; }
.auth-card {
  flex: 0 1 360px;
  background: #fff;
  border-radius: 16px;
  padding: 30px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
  isolation: isolate;
}
.auth-card::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: 17px;
  z-index: -1;
  padding: 1.5px;
  background: conic-gradient(from var(--ring-winkel, 0deg), #2f8f5b, #b08d57, #2f8f5b);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: ring-drehen 6s linear infinite;
}
@keyframes ring-drehen { to { --ring-winkel: 360deg; } }
@property --ring-winkel { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.auth-card h2 { font-size: 20px; margin-bottom: 4px; }
.auth-card .auth-sub { color: var(--text-muted); font-size: 13.5px; margin-bottom: 18px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; padding: 12px; font-size: 15px; }
.auth-fehler {
  background: #fee2e2;
  color: #b91c1c;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.auth-fehler.sichtbar { display: block; }
.auth-fuss { margin-top: 16px; font-size: 12px; color: var(--text-muted); text-align: center; line-height: 1.5; }
.angemeldet-als { font-size: 12px; opacity: 0.7; margin-bottom: 8px; }
.logout-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--sidebar-text);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  cursor: pointer;
  width: 100%;
}
.logout-btn:hover { background: rgba(255,255,255,0.15); }

/* ---------- Charts ---------- */
.chart-kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.chart-select {
  font-size: 12px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.chart-ziel { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.chart-ziel input {
  width: 90px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  text-align: right;
}
.chart-legende { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.chart-legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
#chart-tip {
  position: fixed;
  z-index: 300;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(6px);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 12.5px;
  pointer-events: none;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  min-width: 170px;
}
#chart-tip.hidden { display: none; }
#chart-tip .tip-titel { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: #94a3b8; margin-bottom: 7px; }
#chart-tip .tip-zeile { display: flex; align-items: center; gap: 7px; padding: 2px 0; font-variant-numeric: tabular-nums; }
#chart-tip .tip-zeile i { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }

/* ---------- Kundenportal ---------- */
.portal-fehler { max-width: 480px; margin: 15vh auto; text-align: center; color: #fff; padding: 24px; }
.portal-fehler h1 { font-size: 22px; margin-bottom: 10px; }
.portal-seite { max-width: 720px; margin: 0 auto; padding: 40px 20px 60px; position: relative; z-index: 1; }
.portal-kopf { display: flex; align-items: center; gap: 16px; margin-bottom: 32px; }
.portal-kopf img { max-height: 52px; max-width: 140px; border-radius: 8px; background: #fff; padding: 4px; }
.portal-logo-platzhalter {
  width: 52px; height: 52px; border-radius: 12px;
  background: var(--accent-grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
}
.portal-firma { font-size: 20px; font-weight: 800; color: #fff; }
.portal-kunde { font-size: 13.5px; color: #b9c9bd; }
.portal-sektion { margin-bottom: 30px; }
.portal-sektion h2 { color: #fff; font-size: 16px; margin-bottom: 12px; }
.portal-karte {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 12px;
  color: #e7ede8;
}
.portal-karte-kopf { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.portal-karte-info { font-size: 12.5px; color: #b9c9bd; margin-bottom: 8px; }
.portal-karte-total { font-size: 20px; font-weight: 800; color: #fff; margin-bottom: 12px; }
.portal-karte-aktionen { display: flex; gap: 8px; flex-wrap: wrap; }
.portal-fuss { text-align: center; font-size: 11px; color: #7f9587; margin-top: 20px; }

/* ---------- Command Palette ---------- */
#cmdk {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(15,23,17,0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
}
#cmdk.hidden { display: none; }
#cmdk-box {
  width: 100%;
  max-width: 560px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}
#cmdk-input {
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 16px 18px;
  font-size: 16px;
  outline: none;
  font-family: inherit;
}
#cmdk-results { overflow-y: auto; padding: 6px; }
.cmdk-gruppe { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 10px 12px 4px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.cmdk-item.aktiv { background: var(--accent-grad); color: #fff; }
.cmdk-item.aktiv .cmdk-sub { color: rgba(255,255,255,0.75); }
.cmdk-icon { font-size: 16px; flex: 0 0 auto; }
.cmdk-titel { flex: 1; font-size: 14px; }
.cmdk-sub { font-size: 12px; color: var(--text-muted); }
.cmdk-leer { padding: 30px; text-align: center; color: var(--text-muted); font-size: 13px; }
#cmdk-fuss { display: flex; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-muted); }
.cmdk-hint {
  font-size: 11px;
  color: var(--sidebar-text);
  opacity: 0.6;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  padding: 2px 6px;
  margin-left: auto;
  cursor: pointer;
}

/* ---------- Floating Action Menu ---------- */
#fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
#fab.hidden { display: none; }
#fab-knopf {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent-grad);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(29,107,66,0.45);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
#fab.offen #fab-knopf { transform: rotate(45deg); }
.fab-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(20, 30, 46, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
#fab.offen .fab-menu { opacity: 1; transform: none; pointer-events: auto; }
.fab-item {
  background: none;
  border: none;
  color: #e2e8f0;
  font-size: 14px;
  text-align: left;
  padding: 9px 14px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
}
.fab-item:hover { background: rgba(255,255,255,0.1); }
.fab-trenner { height: 1px; background: rgba(255,255,255,0.12); margin: 3px 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  #sidebar {
    position: static;
    width: auto;
    margin: 8px;
    border-radius: 14px;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 4px 8px;
  }
  .logo-row { padding: 10px 12px; }
  .logo { font-size: 18px; }
  #sidebar-firmenlogo { max-height: 22px; }
  #sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 2px; padding: 0; }
  .nav-btn { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
  .sidebar-footer { padding: 4px 8px; display: flex; align-items: center; }
  .angemeldet-als { display: none; }
  .logout-btn { width: auto; white-space: nowrap; }
  #app { flex-direction: column; }
  #main { margin-left: 0; padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  #modal { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  table.list th, table.list td { padding: 8px 8px; }
  table.list, table.doc-positionen, table.pos-editor { display: block; overflow-x: auto; }
}

.link { color: var(--accent); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.muted { color: var(--text-muted); }
.mono { font-variant-numeric: tabular-nums; }

/* ============================================================
   Druckansicht: A4-Dokument mit Schweizer QR-Zahlteil
   Alle Masse in mm gemäss SIX Style Guide QR-Rechnung
   ============================================================ */
#print-area { display: none; }

@media print {
  body * { visibility: hidden; }
  #app, #modal-backdrop, #toast { display: none !important; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { display: block; position: absolute; top: 0; left: 0; width: 210mm; }
  @page { size: A4 portrait; margin: 0; }
}

.a4-page {
  width: 210mm;
  min-height: 296mm;
  background: #fff;
  position: relative;
  page-break-after: always;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #000;
}
.a4-body { padding: 18mm 20mm 10mm 20mm; }

.doc-brief-head { display: flex; justify-content: space-between; margin-bottom: 14mm; }
.absender { font-size: 10pt; line-height: 1.5; }
.absender .firma { font-weight: 700; font-size: 13pt; margin-bottom: 2mm; }
.empfaenger { font-size: 10pt; line-height: 1.5; margin-top: 16mm; }

.doc-title-row { margin: 8mm 0 6mm; }
.doc-title-row h1 { font-size: 16pt; margin: 0 0 1mm; }
.doc-title-row .doc-info { font-size: 9pt; color: #333; display: flex; gap: 8mm; flex-wrap: wrap; }

table.print-pos { width: 100%; border-collapse: collapse; font-size: 9.5pt; margin-top: 4mm; }
table.print-pos th { text-align: left; border-bottom: 1.5px solid #000; padding: 2mm 1.5mm; font-size: 8.5pt; text-transform: uppercase; letter-spacing: 0.02em; }
table.print-pos td { padding: 2.2mm 1.5mm; border-bottom: 0.5px solid #ccc; vertical-align: top; }
table.print-pos .num { text-align: right; font-variant-numeric: tabular-nums; }
table.print-totals { width: 70mm; margin-left: auto; margin-top: 4mm; border-collapse: collapse; font-size: 9.5pt; }
table.print-totals td { padding: 1.2mm 1.5mm; }
table.print-totals .num { text-align: right; font-variant-numeric: tabular-nums; }
table.print-totals .grand td { font-weight: 700; font-size: 11pt; border-top: 1.5px solid #000; }
.print-note { font-size: 9pt; margin-top: 8mm; line-height: 1.6; white-space: pre-wrap; }
.print-brand { font-size: 7pt; color: #999; margin-top: 10mm; }

/* --- QR-Zahlteil (105mm hoch, unten auf der Seite) --- */
.qr-bill {
  position: absolute;
  bottom: 0; left: 0;
  width: 210mm;
  height: 105mm;
  border-top: 1px dashed #000;
  display: flex;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #fff;
}
.qr-receipt {
  width: 62mm;
  height: 105mm;
  border-right: 1px dashed #000;
  padding: 5mm;
  display: flex;
  flex-direction: column;
}
.qr-payment {
  width: 148mm;
  height: 105mm;
  padding: 5mm;
  display: flex;
}
.qr-payment-left { width: 51mm; display: flex; flex-direction: column; }
.qr-payment-right { flex: 1; padding-left: 5mm; }
.qr-bill .qr-title { font-size: 11pt; font-weight: 700; margin-bottom: 3mm; }
.qr-bill .qr-heading { font-size: 6pt; font-weight: 700; margin-top: 2.2mm; }
.qr-payment .qr-heading { font-size: 8pt; }
.qr-bill .qr-value { font-size: 8pt; line-height: 1.25; }
.qr-payment .qr-value { font-size: 10pt; }
.qr-receipt .qr-amount-row, .qr-payment .qr-amount-row { display: flex; gap: 8mm; margin-top: auto; }
.qr-payment .qr-amount-row { margin-top: 4mm; }
.qr-receipt .qr-acceptance { text-align: right; font-size: 6pt; font-weight: 700; margin-top: 2mm; }
.qr-code-box { width: 46mm; height: 46mm; margin: 4mm 0; position: relative; }
.qr-code-box > svg:first-child, .qr-code-box img { width: 46mm; height: 46mm; display: block; }
.qr-code-box svg.swiss-cross {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 7mm; height: 7mm;
}
.qr-further-info { font-size: 7pt; margin-top: auto; }
