/* Studio-App für Gutscheine. Farben, Schriften, Knopf- und Feldformen stammen aus src/styles (global.css, components.css)
   der Website – hier von Hand übernommen, weil die App ohne Build-Schritt und ohne Tailwind auskommt.
   Für Handys an der Theke gebaut: eine Spalte, Tippflächen mindestens 44 px, Eingaben mindestens 16 px (kein Zoom auf iPhones). */

@font-face { font-family: "Newsreader Variable"; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url("fonts/newsreader-latin-wght-normal.woff2") format("woff2-variations"); }
@font-face { font-family: "Inter Variable"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("fonts/inter-latin-wght-normal.woff2") format("woff2-variations"); }
@font-face { font-family: "Geist Mono Variable"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("fonts/geist-mono-latin-wght-normal.woff2") format("woff2-variations"); }
@font-face { font-family: "Inter Fallback"; src: local("Arial");
  size-adjust: 107.1%; ascent-override: 90.4%; descent-override: 22.5%; line-gap-override: 0%; }
@font-face { font-family: "Newsreader Fallback"; src: local("Georgia");
  size-adjust: 96.2%; ascent-override: 76.4%; descent-override: 27.6%; line-gap-override: 0%; }

:root {
  --font-serif: "Newsreader Variable", "Newsreader Fallback", Georgia, serif;
  --font-sans: "Inter Variable", "Inter Fallback", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Geist Mono Variable", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --ink-strong: #201f1a;
  --ink: #413f32;
  --ink-2: #5f5e56;
  --ink-3: #6d6c64;
  --line-ui: #75746c;
  --line: rgb(65 63 50 / .10);
  --line-2: rgb(65 63 50 / .20);
  --paper: #f5f5f5;
  --paper-2: #eaeaea;
  --card: #ffffff;
  --sage: #c7d2ac;
  --sage-70: #d8e0c5;
  --sage-50: #e3e9d5;
  --stage: #615e50;
  --apricot: #ebab66;
  --error: #8a3d14;
  --error-bg: #f6e9e1;
  --warn-bg: #fbeedd;
  --radius-card: 16px;
  --radius-row: 12px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font-family: var(--font-sans); font-size: 1rem; line-height: 1.4; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
h1, h2, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink-strong); outline-offset: 2px; }
h1:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ───────────── Rahmen ───────────── */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 520px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top, 0px)) 20px 6px;
}
.top__brand, .top__user, .t-label {
  font-family: var(--font-mono); font-size: .75rem; line-height: 1.4; letter-spacing: .1em; text-transform: uppercase; color: var(--ink);
}
.top__user { color: var(--ink-2); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { max-width: 520px; margin: 0 auto; padding: 10px 20px calc(var(--nav-h) + var(--safe-b) + 32px); outline: none; }
.view { display: flex; flex-direction: column; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack:empty { display: none; }
.loading { padding: 32px 0; text-align: center; color: var(--ink-2); }
.loading::before {
  content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--ink); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.t-title { font-family: var(--font-serif); font-weight: 400; font-size: 2rem; line-height: 1.06; color: var(--ink-strong); margin-top: 6px; letter-spacing: -.01em; }
.t-title--light { color: #fafafa; }
.lead { color: var(--ink-2); margin-top: -6px; }
.card { background: var(--card); border-radius: var(--radius-card); padding: 20px; }
.card > .t-label { margin-bottom: 8px; }
.foot { text-align: center; padding: 8px 0; }
.foot--legal { padding-top: 0; color: var(--ink-2); font-size: .875rem; }
.foot--legal .link { display: inline-flex; align-items: center; font-size: .875rem; color: var(--ink-2); }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: .875rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.empty { color: var(--ink-2); padding: 8px 0; }
.link {
  min-height: 44px; padding: 10px 6px; border: 0; background: none; color: var(--ink); text-decoration: underline;
  text-underline-offset: 3px; text-decoration-color: var(--line-ui); font-size: .9375rem; text-align: left;
}
.back {
  display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; min-height: 44px; margin: -6px 0 -8px -8px; padding: 8px 12px 8px 4px;
  border: 0; border-radius: 9999px; background: none; color: var(--ink); font-size: .9375rem;
}

/* ───────────── Knöpfe (Kapsel wie auf der Website) ───────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 14px 26px;
  border: 1px solid transparent; border-radius: 9999px; background: transparent; color: var(--ink);
  font-family: var(--font-sans); font-size: 1rem; line-height: 1.2; text-decoration: none; text-align: center;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), opacity .15s var(--ease);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn--block { display: flex; width: 100%; }
.btn--primary { background: var(--sage); border-color: var(--sage); color: var(--ink-strong); }
.btn--outline { border-color: var(--line-ui); }
.btn--white { background: #fff; border-color: #fff; }
.btn--glass { border-color: rgb(255 255 255 / .6); background: rgb(255 255 255 / .08); color: #fafafa; }
.btn--glass[aria-pressed="true"] { background: #fafafa; color: var(--ink-strong); }
.btn--danger { background: var(--error); border-color: var(--error); color: #fff; }
.btn--warn { color: var(--error); border-color: var(--error); }
.btn--xl { min-height: 76px; font-size: 1.125rem; }
.btn--xl svg { width: 28px; height: 28px; }
.btn--sm { min-height: 44px; padding: 8px 18px; font-size: .875rem; }
.btn svg { flex: none; }
.btn:active { opacity: .82; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.is-busy { opacity: 1; }
.btn.is-busy > span { opacity: .55; }
.btn.is-busy::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgb(32 31 26 / .25); border-top-color: currentColor;
  animation: spin .8s linear infinite;
}
@media (hover: hover) {
  .btn--primary:hover { background: var(--sage-70); border-color: var(--sage-70); }
  .btn--outline:hover { background: rgb(176 174 167 / .10); }
}

/* ───────────── Felder ───────────── */
.field { display: flex; flex-direction: column; min-width: 0; }
.field__label { color: var(--ink); }
.field__opt { color: var(--ink-2); text-transform: none; letter-spacing: 0; font-family: var(--font-sans); font-size: .8125rem; }
.field__input {
  appearance: none; -webkit-appearance: none; width: 100%; min-height: 52px; padding: 14px 0 10px; border: 0; border-radius: 0; background: transparent;
  border-bottom: 1px solid var(--line-ui); color: var(--ink-strong); font-family: var(--font-sans); font-size: 1.125rem; line-height: 1.2;
}
textarea.field__input { min-height: 76px; resize: vertical; line-height: 1.4; }
select.field__input {
  padding-right: 28px; background-repeat: no-repeat; background-position: right 4px center; background-size: 16px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23413f32' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
}
.field__input::placeholder { color: var(--ink-3); opacity: .7; }
.field__input:focus, .field__input:focus-visible { outline: none; box-shadow: inset 0 -2px 0 var(--ink-strong); border-bottom-color: var(--ink-strong); background: rgb(227 233 213 / .5); }
.field__input[aria-invalid="true"] { box-shadow: inset 0 -2px 0 var(--error); border-bottom-color: var(--error); }
.field__input--code { font-family: var(--font-mono); font-size: 1.125rem; letter-spacing: .04em; text-transform: uppercase; }
.field__input--code::placeholder { letter-spacing: .02em; }
.field__hint { margin-top: 6px; font-size: .875rem; color: var(--ink-2); min-height: 1.3em; }
.field__error { margin-top: 6px; font-size: .9375rem; line-height: 1.3; color: var(--error); font-weight: 500; }
.amount { position: relative; }
.amount__unit { position: absolute; right: 2px; bottom: 10px; font-family: var(--font-serif); font-size: 2rem; line-height: 1; color: var(--ink-2); pointer-events: none; }
.field__input--amount { font-family: var(--font-serif); font-size: 2.5rem; min-height: 68px; padding: 10px 40px 6px 0; font-variant-numeric: lining-nums tabular-nums; }
.rest { font-size: 1rem; color: var(--ink); margin-top: -8px; min-height: 1.4em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 8px 18px; border: 1px solid var(--line-ui); border-radius: 9999px; background: transparent; color: var(--ink);
  font-size: .9375rem; touch-action: manipulation;
}
.chip:active { background: var(--sage-50); }
.check { display: flex; align-items: flex-start; gap: 14px; padding: 6px 0; }
.check__box { appearance: none; -webkit-appearance: none; flex: none; width: 30px; height: 30px; margin: 0; border: 1.5px solid var(--line-ui); border-radius: 8px; background: #fff; cursor: pointer; }
.check__box:checked {
  background: var(--sage) center / 20px no-repeat url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23201f1a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12.500l4.500 4.500L19 7.500'/></svg>");
  border-color: var(--ink);
}
.check__label { flex: 1; min-height: 44px; padding-top: 4px; font-size: 1rem; line-height: 1.35; cursor: pointer; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* ───────────── Meldungen ───────────── */
.msg { padding: 12px 14px; border-radius: var(--radius-row); font-size: .9375rem; line-height: 1.4; background: var(--paper); color: var(--ink); }
.card .msg--info { background: var(--paper); }
.msg--ok { background: var(--sage-50); color: var(--ink-strong); }
.msg--warn { background: var(--warn-bg); color: var(--ink-strong); }
.msg--error { background: var(--error-bg); color: var(--error); font-weight: 500; }
.view > .msg--info { background: var(--paper-2); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 60; transform: translate(-50%, 12px);
  width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 14px; background: var(--ink-strong); color: #fafafa;
  font-size: .9375rem; opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ───────────── Gutschein ───────────── */
.pill {
  display: inline-flex; align-items: center; justify-content: center; height: 26px; padding: 0 12px; border: 1px solid currentColor; border-radius: 9999px;
  font-family: var(--font-mono); font-size: .75rem; line-height: 1; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; color: var(--ink);
}
.pill--ok { background: var(--sage-50); border-color: var(--sage); color: var(--ink-strong); }
.pill--warn { background: var(--warn-bg); border-color: var(--apricot); color: var(--ink-strong); }
.pill--off { color: var(--ink-2); background: var(--paper); border-color: var(--line-2); }
.balance { display: flex; flex-direction: column; gap: 6px; }
.balance__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.balance__caption { color: var(--ink-2); font-size: .9375rem; }
.balance__amount, .done__balance, .confirm__amount, .done__amount {
  font-family: var(--font-serif); font-weight: 400; color: var(--ink-strong); line-height: 1; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.01em;
}
.balance__amount { font-size: 3.5rem; }
.balance__sub { color: var(--ink-2); font-size: .9375rem; }
.balance__text { margin-top: 12px; }
.balance .msg { margin-top: 8px; }
.balance .link { align-self: flex-start; }
.facts { display: flex; flex-direction: column; margin-top: 12px; }
.facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.facts dt { color: var(--ink-2); }
.facts dd { color: var(--ink-strong); text-align: right; overflow-wrap: anywhere; }
.facts__strong dt, .facts__strong dd { color: var(--ink-strong); font-weight: 600; font-size: 1.0625rem; }
.facts--small { font-size: .875rem; margin-top: 8px; }

.txs > li + li { border-top: 1px solid var(--line); }
.tx { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; }
.tx__main { min-width: 0; }
.tx__kind { color: var(--ink-strong); font-weight: 500; }
.tx__flag { display: block; color: var(--error); font-weight: 400; font-size: .875rem; }
.tx__number { font-family: var(--font-mono); font-size: .8125rem; letter-spacing: .04em; color: var(--ink); }
button.tx__number { min-height: 44px; padding: 4px 0; display: block; }
.tx__meta, .tx__note { font-size: .875rem; color: var(--ink-2); overflow-wrap: anywhere; }
.tx__note { font-style: italic; }
.tx__side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.tx__amount { font-variant-numeric: tabular-nums; color: var(--ink-strong); white-space: nowrap; font-weight: 500; }
.tx__amount.is-plus { color: #4c5a2a; }
.tx.is-reversed .tx__amount { text-decoration: line-through; color: var(--ink-3); }

/* ───────────── Bestätigung und Ergebnis ───────────── */
.sheet {
  width: 100%; max-width: 520px; max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 24px 24px 0 0;
  background: var(--card); color: var(--ink); overflow: auto; overscroll-behavior: contain;
}
.sheet::backdrop { background: rgb(32 31 26 / .55); }
.sheet__form { display: flex; flex-direction: column; gap: 16px; padding: 24px 20px calc(20px + var(--safe-b)); }
.sheet__title { font-family: var(--font-serif); font-weight: 400; font-size: 1.625rem; line-height: 1.1; color: var(--ink-strong); }
.sheet__lead { color: var(--ink-2); margin-top: -6px; }
.sheet__actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.confirm__amount { font-size: 3.5rem; text-align: center; padding: 6px 0 2px; }
@media (min-width: 560px) { .sheet { margin: auto; border-radius: 24px; } }

.done { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 28px 20px 24px; }
.done__mark { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--sage); color: var(--ink-strong); margin-bottom: 6px; }
.done__title { font-family: var(--font-mono); font-size: .8125rem; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.done__amount { font-size: 3rem; margin-top: 2px; }
.done__sub { color: var(--ink-2); font-size: .9375rem; }
.done__rest { width: 100%; margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.done__balance { font-size: 2.25rem; }
.done .msg { margin-top: 12px; text-align: left; width: 100%; }
.code { font-family: var(--font-mono); font-size: 1.1875rem; letter-spacing: .06em; color: var(--ink-strong); user-select: all; -webkit-user-select: all; white-space: nowrap; }
.printframe { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }

/* ───────────── Scannen ───────────── */
body.is-bare { background: var(--ink-strong); }
body.is-bare .top__brand, body.is-bare .top__user { color: rgb(250 250 250 / .8); }
body.is-bare .main { padding-bottom: calc(24px + var(--safe-b)); }
.scan__stage { position: relative; width: 100%; aspect-ratio: 1; max-height: 60dvh; border-radius: 24px; overflow: hidden; background: #000; }
.scan__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan__frame { position: absolute; inset: 14%; border-radius: 20px; box-shadow: 0 0 0 100vmax rgb(0 0 0 / .35); outline: 2px solid rgb(255 255 255 / .9); outline-offset: -1px; }
.scan__hint { min-height: 2.8em; text-align: center; color: #fafafa; }
.scan__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.scan__off { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 24px; background: var(--stage); color: #fafafa; text-align: center; }

/* ───────────── Listen: Tag, Suche, Konten, Menü ───────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--card); border-radius: var(--radius-card); padding: 16px; }
.tile__value { font-family: var(--font-serif); font-size: 1.75rem; line-height: 1.1; color: var(--ink-strong); margin-top: 6px; font-variant-numeric: lining-nums tabular-nums; }
.tile__sub { font-size: .8125rem; color: var(--ink-2); margin-top: 2px; }
.menu { padding-bottom: 8px; }
.menu__info { color: var(--ink-2); padding-bottom: 8px; }
.menu__item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 60px; padding: 10px 0;
  border: 0; border-top: 1px solid var(--line); background: none; text-align: left; color: var(--ink-strong);
}
.menu__text { display: flex; flex-direction: column; }
.menu__text small { color: var(--ink-2); font-size: .875rem; }
.hits > li + li { border-top: 1px solid var(--line); }
.hit { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 60px; padding: 10px 0; border: 0; background: none; text-align: left; }
.hit__main { display: flex; flex-direction: column; min-width: 0; }
.hit__main strong { font-family: var(--font-mono); font-weight: 400; letter-spacing: .04em; color: var(--ink-strong); }
.hit__main small { color: var(--ink-2); font-size: .875rem; }
.users > li + li { border-top: 1px solid var(--line); }
.user { padding: 14px 0; display: flex; flex-direction: column; gap: 6px; }
.user__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.user__name { color: var(--ink-strong); font-weight: 500; font-size: 1.0625rem; }
.user__name small { color: var(--ink-2); font-weight: 400; }
.user__meta { color: var(--ink-2); font-size: .875rem; }
.user__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.user.is-off .user__name { color: var(--ink-3); }

/* ───────────── Leiste unten ───────────── */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; justify-content: center;
  padding-bottom: var(--safe-b); background: rgb(255 255 255 / .96); border-top: 1px solid var(--line-2);
}
.nav__tab {
  flex: 1; max-width: 130px; min-height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--ink-2); font-size: .75rem; touch-action: manipulation;
}
.nav__tab.is-active { color: var(--ink-strong); font-weight: 600; }
.nav__tab svg { box-sizing: border-box; width: 56px; height: 32px; padding: 4px 16px; border-radius: 9999px; }
.nav__tab.is-active svg { background: var(--sage); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1.6s !important; transition: none !important; }
}
@media print { .nav, .top, .toast { display: none; } }
