/* =========================================================================
   Stempelkarte — Design-System
   Aufgebaut nach Apple-Interface-Prinzipien:
   · Response: Feedback auf pointer-down, nie erst auf Release
   · Motion: kritisch gedämpfte Springs (kein Overshoot), Bounce nur nach Impuls
   · Material: translucente Ebenen mit backdrop-filter, Tiefe statt Linien
   · Typografie: größenabhängiges Tracking, Leading invers zur Größe
   · Zurückhaltung: jedes Element verdient seinen Platz
   · Barrierefreiheit: reduced-motion / reduced-transparency / contrast
   ========================================================================= */

:root {
  /* --- Farbe: Grundton neutral-kühl, Akzent aus dem Branding --- */
  --ink: #0b1420;
  --ink-2: #37475c;
  --ink-3: #6b7c93;
  --ink-4: #9aa8bb;

  --canvas: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfcfd;
  --hairline: rgba(11, 20, 32, .09);
  --hairline-strong: rgba(11, 20, 32, .16);

  --brand: #0d2440;
  --brand-hover: #16375c;
  --brand-tint: rgba(13, 36, 64, .07);

  --green: #16a34a;
  --green-tint: #e7f6ec;
  --amber: #d97706;
  --amber-tint: #fdf1e0;
  --blue: #2563eb;
  --blue-tint: #e8effd;
  --violet: #7c3aed;
  --violet-tint: #f0eafe;
  --red: #dc2626;
  --red-tint: #fdeaea;

  /* --- Elevation: größere Flächen wirken dicker --- */
  --lift-1: 0 1px 2px rgba(11, 20, 32, .05), 0 1px 3px rgba(11, 20, 32, .04);
  --lift-2: 0 2px 6px rgba(11, 20, 32, .06), 0 8px 20px rgba(11, 20, 32, .05);
  --lift-3: 0 8px 20px rgba(11, 20, 32, .09), 0 24px 48px rgba(11, 20, 32, .10);

  /* --- Radien: konsistente Rundungsfamilie --- */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-pill: 999px;

  /* --- Motion: Response = wie schnell das Ziel erreicht wird --- */
  --spring: cubic-bezier(.32, .72, 0, 1);      /* kritisch gedämpft, kein Overshoot */
  --spring-bounce: cubic-bezier(.2, 1.5, .4, 1); /* Bounce nur nach echtem Impuls */
  --t-fast: 140ms;
  --t-base: 260ms;
  --t-slow: 420ms;

  --sidebar-w: 274px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* Systemschrift bringt optisches Sizing und Tracking-Tabellen mit */
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
}

/* Typografie: Tracking eng bei großen Graden, Leading invers zur Größe */
h1, .t-display {
  font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.2rem);
  line-height: 1.1;
  letter-spacing: -.025em;
  font-weight: 700;
  margin: 0 0 .35rem;
}
h2, .t-title {
  font-size: 1.0625rem;
  line-height: 1.3;
  letter-spacing: -.012em;
  font-weight: 650;
  margin: 0 0 .8rem;
}
h3 { font-size: .95rem; line-height: 1.35; letter-spacing: -.008em; font-weight: 650; margin: 0 0 .5rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--ink-3); }
.small { font-size: .8125rem; letter-spacing: .003em; } /* kleine Grade: leicht positives Tracking */
.tabular { font-variant-numeric: tabular-nums; }

a { color: var(--brand); text-decoration-color: color-mix(in srgb, var(--brand) 30%, transparent); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .78rem;
  background: var(--brand-tint);
  padding: .15em .45em;
  border-radius: 6px;
}

/* Sichtbarer, ruhiger Fokus — Tastaturbedienung ist erstklassig */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

/* =============================== Portal ================================= */

.portal { display: flex; min-height: 100vh; }

/* Sidebar als strukturierende, schwerere Materialebene */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-right: 1px solid var(--hairline);
  padding: 20px 14px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.06rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
  padding: 4px 8px 18px;
}
.sidebar .brand img { max-height: 30px; max-width: 150px; display: block; }
.sidebar .brand .mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: .95rem;
  box-shadow: var(--lift-1);
}

.shop-switch {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 16px;
  background: var(--surface);
}
.shop-switch .name { font-weight: 650; font-size: .875rem; letter-spacing: -.008em; }
.shop-switch .sub { font-size: .75rem; color: var(--ink-3); }

.nav-group {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .075em;   /* kleine Versalien brauchen Luft */
  color: var(--ink-4);
  text-transform: uppercase;
  padding: 16px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 11px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: background var(--t-fast) var(--spring), color var(--t-fast) var(--spring);
}
.nav-item:hover { background: var(--brand-tint); color: var(--ink); }
/* Response: sofortiges Feedback beim Drücken, nicht erst beim Loslassen */
.nav-item:active { transform: scale(.985); }
.nav-item.active {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--lift-1);
}
.nav-item .ico { width: 20px; text-align: center; font-size: .95rem; }

.sidebar .spacer { flex: 1; min-height: 14px; }

.sidebar-cta {
  display: block;
  background: var(--brand);
  color: #fff;
  text-align: center;
  text-decoration: none;
  font-weight: 650;
  font-size: .9rem;
  padding: 13px 16px;
  border-radius: var(--r-md);
  box-shadow: var(--lift-2);
  transition: transform var(--t-fast) var(--spring), background var(--t-fast) var(--spring);
}
.sidebar-cta:hover { background: var(--brand-hover); }
.sidebar-cta:active { transform: scale(.975); }

.sidebar-user {
  border-top: 1px solid var(--hairline);
  margin-top: 14px;
  padding-top: 12px;
  font-size: .78rem;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { padding: 34px 40px 44px; flex: 1; width: 100%; max-width: 1380px; }
.page-head { margin-bottom: 26px; }
.page-head p { margin: 0; color: var(--ink-3); font-size: .95rem; }
.page-foot {
  border-top: 1px solid var(--hairline);
  padding: 18px 40px;
  text-align: center;
  color: var(--ink-4);
  font-size: .8rem;
}

/* ============================== Flächen ================================= */

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--lift-1);
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 14px;
}
.panel-head h2 { margin: 0; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

/* KPI-Kacheln */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(226px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 19px 21px;
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: var(--lift-1);
  transition: transform var(--t-base) var(--spring), box-shadow var(--t-base) var(--spring);
}
a.kpi:hover { transform: translateY(-2px); box-shadow: var(--lift-2); }
a.kpi:active { transform: translateY(0) scale(.99); }
.kpi .kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi .kpi-label { font-size: .875rem; color: var(--ink-2); font-weight: 500; }
.kpi .kpi-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.05rem; flex: 0 0 40px;
}
.kpi .kpi-value {
  font-size: 2.35rem; font-weight: 700; letter-spacing: -.035em;
  line-height: 1.05; margin: 12px 0 3px;
  font-variant-numeric: tabular-nums;
}
.kpi .kpi-value .unit { font-size: 1.15rem; font-weight: 650; color: var(--ink-3); letter-spacing: -.01em; }
.kpi .kpi-trend { font-size: .8125rem; font-weight: 600; }
.kpi .kpi-trend.up { color: var(--green); }
.kpi .kpi-trend.down { color: var(--red); }
.kpi .kpi-trend.flat { color: var(--ink-3); }
.kpi .kpi-trend span { color: var(--ink-3); font-weight: 450; }

.ico-green { background: var(--green-tint); color: #15803d; }
.ico-amber { background: var(--amber-tint); color: #b45309; }
.ico-blue { background: var(--blue-tint); color: #1d4ed8; }
.ico-violet { background: var(--violet-tint); color: #6d28d9; }
.ico-red { background: var(--red-tint); color: #b91c1c; }

/* Segment-Chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 12px 16px;
  text-decoration: none;
  color: inherit;
  min-width: 126px;
  background: var(--surface);
  transition: transform var(--t-fast) var(--spring), border-color var(--t-fast) var(--spring), box-shadow var(--t-fast) var(--spring);
}
.chip:hover { border-color: var(--hairline-strong); box-shadow: var(--lift-1); transform: translateY(-1px); }
.chip:active { transform: translateY(0) scale(.985); }
.chip .n { font-size: 1.5rem; font-weight: 700; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.chip .l { font-size: .78rem; color: var(--ink-3); }

/* ============================= Formulare ================================ */

label { display: block; font-size: .8125rem; font-weight: 600; margin: 14px 0 5px; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=url], input[type=file], select, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-sm);
  font-size: .95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--t-fast) var(--spring), box-shadow var(--t-fast) var(--spring);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3.5px var(--brand-tint);
}
input:disabled, input[readonly] { background: var(--canvas); color: var(--ink-3); cursor: not-allowed; }
input[type=color] { width: 54px; height: 40px; padding: 3px; border-radius: var(--r-sm); cursor: pointer; }
textarea { min-height: 112px; resize: vertical; line-height: 1.6; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 150px; }
.hint { font-size: .78rem; color: var(--ink-3); margin: 6px 0 0; line-height: 1.5; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-top: 14px; cursor: pointer; }
.check input { margin-top: 3px; flex: 0 0 auto; width: auto; accent-color: var(--brand); }

/* Schalter statt Checkbox, wo es um An/Aus geht */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: .85rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 46px; height: 28px; border-radius: var(--r-pill);
  background: #d3dae4; position: relative; flex: 0 0 46px;
  transition: background var(--t-base) var(--spring);
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: var(--lift-1);
  transition: transform var(--t-base) var(--spring);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ============================== Buttons ================================= */

.btn {
  display: inline-block; border: 0; cursor: pointer;
  background: var(--brand); color: #fff;
  font-size: .95rem; font-weight: 650; font-family: inherit;
  letter-spacing: -.005em;
  padding: 12px 22px; border-radius: var(--r-sm);
  text-decoration: none; text-align: center;
  box-shadow: var(--lift-1);
  transition: transform var(--t-fast) var(--spring), background var(--t-fast) var(--spring), box-shadow var(--t-fast) var(--spring);
}
.btn:hover { background: var(--brand-hover); box-shadow: var(--lift-2); }
.btn:active { transform: scale(.97); box-shadow: var(--lift-1); }  /* Feedback auf Druck */
.btn.block { display: block; width: 100%; }
.btn.ghost { background: var(--brand-tint); color: var(--ink-2); box-shadow: none; }
.btn.ghost:hover { background: color-mix(in srgb, var(--brand) 12%, transparent); }
.btn.green { background: var(--green); }
.btn.green:hover { background: #15803d; }
.btn.danger { background: var(--red); }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 8px 14px; font-size: .8125rem; border-radius: 9px; }
.btn.large { padding: 15px 26px; font-size: 1.02rem; border-radius: var(--r-md); }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; box-shadow: none; }

/* Dezenter Textlink-Button (z. B. „Daten ansehen") */
.link-btn {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  color: var(--ink-3); font: inherit; font-size: .85rem; font-weight: 550;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color var(--t-fast) var(--spring);
}
.link-btn:hover { color: var(--ink); }
.link-btn .caret { transition: transform var(--t-base) var(--spring); font-size: .7em; }
.link-btn[aria-expanded="true"] .caret { transform: rotate(90deg); }

/* ============================== Meldungen =============================== */

.flash {
  padding: 13px 16px; border-radius: var(--r-md); margin-bottom: 18px;
  font-size: .9rem; font-weight: 500; line-height: 1.5;
  animation: flash-in var(--t-slow) var(--spring) both;
}
.flash.success { background: var(--green-tint); color: #14532d; }
.flash.error { background: var(--red-tint); color: #7f1d1d; }
.flash.info { background: var(--blue-tint); color: #1e3a8a; }
@keyframes flash-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* ============================== Tabellen ================================ */

table.list { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.list th, table.list td {
  text-align: left; padding: 11px 12px;
  border-bottom: 1px solid var(--hairline); vertical-align: middle;
}
table.list th {
  color: var(--ink-3); font-size: .7rem; text-transform: uppercase;
  letter-spacing: .07em; font-weight: 700;
}
table.list tbody tr { transition: background var(--t-fast) var(--spring); }
table.list tbody tr:hover { background: var(--surface-2); }
table.list tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 650; letter-spacing: .01em;
  background: var(--brand-tint); color: var(--ink-2); white-space: nowrap;
}
.badge.on { background: var(--green-tint); color: #15803d; }
.badge.off { background: #eef1f5; color: var(--ink-3); }
.badge.warn { background: var(--amber-tint); color: #b45309; }

/* ============================ Diagramme ================================= */

.bars { display: flex; align-items: flex-end; gap: 7px; height: 132px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; }
.bars .bar .fill {
  width: 100%; background: var(--brand); border-radius: 6px 6px 2px 2px; min-height: 3px;
  animation: bar-rise var(--t-slow) var(--spring) both;
  transform-origin: bottom;
}
@keyframes bar-rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bars .bar .n { font-size: .72rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bar-labels { display: flex; gap: 7px; margin-top: 6px; }
.bar-labels div { flex: 1; text-align: center; font-size: .69rem; color: var(--ink-4); }

.hbar { display: flex; align-items: center; gap: 10px; margin: 9px 0; }
.hbar .lbl { width: 195px; font-size: .84rem; color: var(--ink-2); }
.hbar .track { flex: 1; background: #eef1f5; border-radius: var(--r-pill); overflow: hidden; height: 16px; }
.hbar .fill {
  height: 100%; border-radius: var(--r-pill); background: var(--green);
  animation: hbar-grow var(--t-slow) var(--spring) both; transform-origin: left;
}
.hbar .fill.amber { background: var(--amber); }
@keyframes hbar-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.hbar .val { width: 42px; text-align: right; font-size: .82rem; font-weight: 650; font-variant-numeric: tabular-nums; }

/* Timeline */
.tl-item {
  display: flex; gap: 11px; padding: 10px 0;
  border-bottom: 1px solid var(--hairline); font-size: .875rem; line-height: 1.5;
}
.tl-item:last-child { border-bottom: 0; }
.tl-item .when { color: var(--ink-4); font-size: .76rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ====================== Ausklappbereich (Disclosure) ==================== */
/* Höhen-Animation über grid-template-rows: läuft auf dem Compositor und
   funktioniert ohne feste Höhe. */
.disclosure {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--t-base) var(--spring), opacity var(--t-base) var(--spring);
  opacity: 0;
}
.disclosure > .disclosure-inner { overflow: hidden; min-height: 0; }
.disclosure.open { grid-template-rows: 1fr; opacity: 1; }

/* ==================== Öffentliche Kundenoberfläche ====================== */

.public {
  max-width: 470px;
  margin: 0 auto;
  padding: 26px 18px 64px;
}
.public-head { text-align: center; margin-bottom: 20px; }
.public-head h1 { margin: 12px 0 6px; }
.public-head .logo { max-height: 62px; max-width: 210px; margin: 0 auto; display: block; }

/* Die Karte ist das Herzstück — echte Materialtiefe, leichter Glanz */
.wallet-card {
  position: relative;
  border-radius: var(--r-xl);
  padding: 22px;
  box-shadow: var(--lift-3);
  overflow: hidden;
  isolation: isolate;
  animation: card-in var(--t-slow) var(--spring) both;
}
/* Lichtkante oben: fängt Licht wie eine reale Oberfläche */
.wallet-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,0) 42%);
  pointer-events: none;
  z-index: -1;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.wallet-card .wc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.wallet-card .wc-shop { font-weight: 680; font-size: 1.06rem; letter-spacing: -.015em; }
.wallet-card .wc-count { font-size: .95rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.wallet-card .wc-stamps { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; justify-content: center; }
.wallet-card .stamp {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .38);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700;
  animation: stamp-in var(--t-base) var(--spring) both;
}
.wallet-card .stamp.filled {
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
/* Der zuletzt gesetzte Stempel bekommt einen Impuls — Bounce nach „Ereignis" */
.wallet-card .stamp.latest { animation: stamp-pop var(--t-slow) var(--spring-bounce) both; }
@keyframes stamp-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
@keyframes stamp-pop {
  0% { opacity: 0; transform: scale(.4); }
  100% { opacity: 1; transform: scale(1); }
}
.wallet-card .wc-reward { text-align: center; font-size: .9rem; }
.wallet-card .wc-qr {
  background: #fff; border-radius: var(--r-md); padding: 14px;
  margin: 18px auto 4px; width: fit-content;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .16);
}
.wallet-card .wc-serial {
  text-align: center; font-size: .72rem; letter-spacing: .18em;
  opacity: .8; margin-top: 9px; font-variant-numeric: tabular-nums;
}

.wallet-buttons { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }

.card-panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 20px;
  margin: 16px 0;
  box-shadow: var(--lift-1);
}
.card-panel.quiet { background: transparent; border: 0; box-shadow: none; padding: 4px 2px; }

/* Fortschrittszeile unter der Karte */
.progress-line { display: flex; align-items: center; gap: 10px; margin: 14px 2px 0; }
.progress-line .track { flex: 1; height: 8px; border-radius: var(--r-pill); background: #e6eaf0; overflow: hidden; }
.progress-line .fill {
  height: 100%; border-radius: var(--r-pill);
  transition: width var(--t-slow) var(--spring);
}
.progress-line .txt { font-size: .78rem; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* NFC-Tap-Erfolgsseite: der Stempel „landet" mit Impuls */
.tap-seal { position: relative; width: 190px; height: 190px; margin: 0 auto; }
.tap-seal .tap-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 10px solid var(--seal, var(--violet)); opacity: .3;
  animation: tap-ring 1s var(--spring) .1s both;
}
.tap-seal .tap-core {
  position: absolute; inset: 22px; border-radius: 50%;
  background: var(--seal, var(--violet)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .22);
  animation: tap-pop var(--t-slow) var(--spring-bounce) both;
}
.tap-seal .tap-count { font-size: 4rem; font-weight: 750; letter-spacing: -.04em; }
.tap-seal.error .tap-core { background: var(--red-tint); color: #b91c1c; font-size: 3.4rem; animation: none; }
@keyframes tap-pop { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes tap-ring {
  from { transform: scale(.55); opacity: .55; }
  to { transform: scale(1.3); opacity: 0; }
}

/* ============================== Scanner ================================= */

#reader { width: 100%; max-width: 430px; margin: 0 auto; border-radius: var(--r-lg); overflow: hidden; }
.scan-actions { display: flex; gap: 10px; margin-top: 12px; }
.scan-actions .btn { flex: 1; }

.qr-print { text-align: center; }
.qr-print .qr-box {
  background: #fff; display: inline-block; padding: 18px;
  border-radius: var(--r-md); border: 1px solid var(--hairline); box-shadow: var(--lift-1);
}

/* Logo-Vorschau in Einstellungen */
.logo-preview {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 14px; border: 1px solid var(--hairline);
  border-radius: var(--r-md); background: var(--surface-2); margin-top: 8px;
}
.logo-preview img { max-height: 44px; max-width: 180px; display: block; }
.logo-preview.favicon img { max-height: 32px; max-width: 32px; }

/* ============================= Responsive =============================== */

@media (max-width: 900px) {
  .portal { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: sticky; top: 0; z-index: 20;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    gap: 6px; padding: 10px 12px;
  }
  .sidebar .brand { padding: 0 10px 0 0; }
  .sidebar .shop-switch, .sidebar .nav-group, .sidebar .spacer,
  .sidebar .sidebar-cta, .sidebar .sidebar-user { display: none; }
  .nav-item { padding: 8px 11px; font-size: .84rem; }
  .page { padding: 22px 16px 36px; }
  .page-foot { padding: 16px; }
  .hbar .lbl { width: 118px; font-size: .78rem; }
  .kpi .kpi-value { font-size: 2rem; }
}

/* ========================= Barrierefreiheit ============================= */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  /* Ausklappen bleibt nutzbar, nur ohne Bewegung */
  .disclosure { transition: none; }
  .btn:active, .nav-item:active, .chip:active { transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .sidebar { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

@media (prefers-contrast: more) {
  :root { --hairline: rgba(11, 20, 32, .3); --hairline-strong: rgba(11, 20, 32, .5); --ink-3: #4a5a70; }
  .panel, .kpi, .card-panel { border-width: 1.5px; }
  .sidebar { background: var(--surface); backdrop-filter: none; }
}

@media print {
  .sidebar, .no-print, .page-foot, .support-bar { display: none !important; }
  .page { padding: 0; }
  .panel { box-shadow: none; border-color: #ccc; }

  /* Nur einen Ausschnitt drucken: alles ausblenden, den Zielbereich zeigen.
     visibility statt display, damit die Vorfahren-Kette erhalten bleibt. */
  body.print-scope * { visibility: hidden !important; }
  body.print-scope .print-target,
  body.print-scope .print-target * { visibility: visible !important; }
  body.print-scope .print-target {
    position: absolute; inset: 0 auto auto 0;
    width: 100%; padding: 0; margin: 0;
    border: 0; box-shadow: none; background: #fff;
    text-align: center;
  }
  body.print-scope .print-target .no-print { display: none !important; }
}

/* Zeitraum-Auswahl */
.period-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.period-pills .pill {
  border: 0; cursor: pointer; font: inherit;
  background: transparent; color: var(--ink-2);
  font-size: .82rem; font-weight: 550;
  padding: 7px 13px; border-radius: var(--r-pill);
  text-decoration: none; white-space: nowrap;
  transition: background var(--t-fast) var(--spring), color var(--t-fast) var(--spring);
}
.period-pills .pill:hover { background: var(--brand-tint); color: var(--ink); }
.period-pills .pill.active { background: var(--brand); color: #fff; font-weight: 650; }

/* Support-Modus-Banner */
.support-bar {
  background: var(--amber-tint);
  border-bottom: 1px solid rgba(217, 119, 6, .3);
  color: #92400e;
  padding: 10px 20px;
  font-size: .85rem;
  font-weight: 550;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}

/* Kennzahlen-Gruppen mit Überschrift */
.metric-group { margin-bottom: 26px; }
.metric-group > h2 {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 12px;
}
.metric-group > h2 .sub { font-size: .8rem; font-weight: 450; color: var(--ink-3); }

/* Kompakte Kennzahl in Panels */
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px; }
.mini-stat .n { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mini-stat .l { font-size: .76rem; color: var(--ink-3); line-height: 1.35; }

/* Gestapelter Verlaufs-Chart */
.trend { display: flex; align-items: flex-end; gap: 4px; height: 150px; }
.trend .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 0; }
.trend .seg { width: 100%; border-radius: 3px; min-height: 2px; }
.trend .seg.signups { background: var(--green); }
.trend .seg.visits { background: var(--brand); opacity: .75; }
.trend .seg.churn { background: var(--red); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: .78rem; color: var(--ink-3); }
.legend span::before {
  content: ''; display: inline-block; width: 10px; height: 10px;
  border-radius: 3px; margin-right: 6px; vertical-align: middle;
}
.legend .l-signups::before { background: var(--green); }
.legend .l-visits::before { background: var(--brand); opacity: .75; }
.legend .l-churn::before { background: var(--red); }
