/* ================= Paper (shared: app preview, customer page, print) ================= */
.paper {
  --brand: var(--ink);
  --brand-accent: var(--accent);
  position: relative;
  background: #fff;
  color: #17160f;
  font-size: 15px;
  line-height: 1.5;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-2);
  padding: 3em 3.1em 2.4em;
  width: 100%;
  overflow: hidden;
}
.paper[style*="--brand"] { --brand-accent: var(--brand); }
.paper.compact { font-size: 13px; box-shadow: none; }
.paper-head { display: flex; justify-content: space-between; gap: 2em; align-items: flex-start; padding-bottom: 1.5em; border-bottom: 1px solid #ecebe6; }
.paper-brand { display: flex; align-items: center; gap: 0.8em; min-width: 0; }
.paper-logo { max-height: 3.4em; max-width: 12em; object-fit: contain; }
.paper-mono {
  width: 2.7em;
  height: 2.7em;
  border-radius: 0.75em;
  background: var(--brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 650;
  font-size: 0.95em;
  letter-spacing: 0.02em;
  flex: none;
}
.paper-brand-name { min-width: 0; }
.paper-brand-name strong { display: block; font-size: 1.08em; letter-spacing: -0.015em; font-weight: 650; }
.paper-brand-name span { color: #77746b; font-size: 0.86em; }
.paper-from { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-size: 0.8em; color: #6d6a62; line-height: 1.6; }
.paper-meta { display: flex; justify-content: space-between; gap: 2em; padding: 1.6em 0 1.5em; }
.paper-to { display: flex; flex-direction: column; font-size: 0.93em; line-height: 1.5; min-width: 0; }
.paper-to strong { font-weight: 600; }
.paper-label { font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.1em; color: #8a877e; font-weight: 600; margin-bottom: 0.35em; }
.paper-facts { display: grid; grid-template-columns: auto auto; gap: 0.3em 1.8em; margin: 0; font-size: 0.86em; align-content: start; }
.paper-facts div { display: contents; }
.paper-facts dt { color: #8a877e; }
.paper-facts dd { margin: 0; text-align: right; font-weight: 550; white-space: nowrap; }
.paper-title { margin: 0.5em 0 0.9em; }
.paper-kind { font-size: 0.74em; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brand-accent); font-weight: 650; }
.paper-title h1 { font-size: 1.85em; letter-spacing: -0.028em; margin-top: 0.2em; font-weight: 650; line-height: 1.15; }
.paper-intro { white-space: pre-line; color: #3f3d37; margin-bottom: 1.5em; max-width: 62ch; }
.lines { width: 100%; border-collapse: collapse; font-size: 0.93em; }
.lines th { font-size: 0.74em; text-transform: uppercase; letter-spacing: 0.08em; color: #8a877e; font-weight: 600; text-align: left; padding: 0.6em 0; border-bottom: 1.5px solid #17160f; white-space: nowrap; }
.lines td { padding: 0.9em 0; border-bottom: 1px solid #ecebe6; vertical-align: top; }
.lines .num { text-align: right; white-space: nowrap; padding-left: 1.3em; font-family: var(--mono); font-feature-settings: "tnum"; font-size: 0.94em; }
.lines th.num { font-family: var(--sans); }
.ln-title strong { font-weight: 600; display: block; }
.ln-detail { display: block; color: #77746b; font-size: 0.9em; margin-top: 0.15em; }
tr.opt td { background: #fbfaf8; }
tr.opt td:first-child { padding-left: 0.6em; box-shadow: inset 2px 0 0 var(--violet); }
tr.opt td:last-child { padding-right: 0.6em; }
tr.opt.on td { background: #f1faf5; }
tr.opt.on td:first-child { box-shadow: inset 2px 0 0 var(--ok); }
.opt-tag { display: inline-block; margin-top: 0.4em; font-size: 0.7em; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; color: var(--violet); background: var(--violet-soft); padding: 0.2em 0.6em; border-radius: 999px; }
tr.opt.on .opt-tag { color: var(--ok); background: var(--ok-soft); }
.opt-toggle { display: flex; gap: 0.8em; cursor: pointer; align-items: flex-start; position: relative; }
.opt-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.opt-box { width: 1.4em; height: 1.4em; border: 1.5px solid #c9c5bb; background: #fff; border-radius: 0.42em; display: grid; place-items: center; flex: none; margin-top: 0.05em; color: transparent; transition: all 0.15s var(--ease); }
.opt-box .i { width: 0.95em; height: 0.95em; stroke-width: 3; }
.opt-toggle:hover .opt-box { border-color: var(--ok); }
.opt-toggle input:checked + .opt-box { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt-toggle input:focus-visible + .opt-box { box-shadow: var(--ring); }
.paper-totals { margin: 1.3em 0 0 auto; width: min(100%, 22em); font-size: 0.95em; }
.paper-totals > div { display: flex; justify-content: space-between; padding: 0.35em 0; gap: 1em; }
.paper-totals .num { font-family: var(--mono); font-feature-settings: "tnum"; }
.paper-totals .grand { border-top: 1.5px solid #17160f; margin-top: 0.3em; padding-top: 0.75em; font-weight: 700; font-size: 1.14em; }
.paper-totals .deposit-line { color: var(--accent-ink); font-size: 0.9em; }
.paper-foot { margin-top: 2.2em; padding-top: 1.2em; border-top: 1px solid #ecebe6; font-size: 0.8em; color: #6d6a62; display: grid; gap: 0.45em; }

/* Stamp */
.stamp {
  position: absolute;
  top: 6.4em;
  right: 2.4em;
  z-index: 2;
  transform: rotate(-9deg);
  border: 3px solid currentColor;
  border-radius: 10px;
  padding: 0.35em 0.9em 0.45em;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 1.15em;
  line-height: 1.2;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.55);
  mix-blend-mode: multiply;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
}
.stamp small { display: block; font-size: 0.56em; letter-spacing: 0.03em; font-weight: 650; text-transform: none; margin-top: 0.15em; }
.stamp.stamp-ok { color: var(--accent); }
.paper .stamp-ok[aria-label="Bezahlt"] { color: var(--ok); }
.stamp.stamp-muted { color: #8a877e; }
.stamp.anim { animation: stamp-in 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
@keyframes stamp-in {
  0% { opacity: 0; transform: rotate(-9deg) scale(2.3); }
  55% { opacity: 1; transform: rotate(-9deg) scale(0.93); }
  100% { opacity: 1; transform: rotate(-9deg) scale(1); }
}

@media (max-width: 640px) {
  .paper { font-size: 14px; padding: 1.5em 1.25em 1.4em; border-radius: 14px; }
  .paper-head { flex-direction: column; gap: 1em; }
  .paper-from { align-items: flex-start; text-align: left; }
  .paper-meta { flex-direction: column; gap: 1.1em; padding: 1.2em 0 1em; }
  .paper-facts { grid-template-columns: auto 1fr; }
  .paper-facts dd { text-align: left; }
  .paper-title h1 { font-size: 1.55em; }
  .lines .ln-unit, .lines th:nth-child(3) { display: none; }
  .lines .num { padding-left: 0.8em; }
  .stamp { top: 1.2em; right: 1em; font-size: 0.95em; }
}

/* QR bill */
.qrbill { width: 100%; height: auto; display: block; background: #fff; }

/* ================= Customer page ================= */
.doc-body { background: var(--bg); }
.doc-top { position: sticky; top: 0; z-index: 30; background: rgba(246, 245, 241, 0.86); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.doc-top .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; max-width: 1180px; }
.doc-seller { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 600; font-size: 15px; }
.doc-seller .paper-mono { font-size: 12px; width: 32px; height: 32px; border-radius: 9px; background: var(--ink); }
.doc-seller img { max-height: 30px; max-width: 120px; object-fit: contain; }
.doc-page { max-width: 1180px; margin: 0 auto; padding: 28px 24px 120px; }
.doc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.doc-aside { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 14px; }
.doc-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-2); padding: 22px; }
.doc-card h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.doc-amount { font-size: 34px; font-weight: 650; letter-spacing: -0.035em; font-family: var(--sans); font-feature-settings: "tnum"; line-height: 1.1; margin: 6px 0 4px; }
.doc-amount small { font-size: 15px; color: var(--ink-3); font-weight: 500; letter-spacing: 0; margin-right: 4px; }
.doc-card .meta { font-size: 13.5px; color: var(--ink-2); display: grid; gap: 6px; margin: 14px 0 18px; }
.doc-card .meta div { display: flex; justify-content: space-between; gap: 12px; }
.doc-card .meta span:last-child { color: var(--ink); font-weight: 550; }
.doc-actions { display: grid; gap: 8px; }
.doc-trust { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink-3); margin-top: 14px; line-height: 1.45; }
.doc-trust .i { width: 15px; height: 15px; margin-top: 1px; color: var(--ok); }
.doc-state { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: 16px; margin-bottom: 20px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-1); }
.doc-state .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.doc-state h2 { font-size: 17px; letter-spacing: -0.015em; }
.doc-state p { color: var(--ink-2); font-size: 14px; margin-top: 3px; }
.doc-state.ok { background: linear-gradient(180deg, #f2fbf6, #fff); border-color: #c9ead8; }
.doc-state.ok .ic { background: var(--ok); color: #fff; }
.doc-state.warn { background: linear-gradient(180deg, #fff8ee, #fff); border-color: #f1dcb9; }
.doc-state.warn .ic { background: var(--warn); color: #fff; }
.doc-state.neutral .ic { background: var(--surface-3); color: var(--ink-2); }
.doc-state.accent .ic { background: var(--accent); color: #fff; }
.doc-next { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.pay-card { margin-top: 24px; }
.pay-grid { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pay-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.pay-row:last-child { border-bottom: 0; }
.pay-row .k { font-size: 12px; color: var(--ink-3); }
.pay-row .v { font-family: var(--mono); font-size: 14px; font-weight: 500; word-break: break-all; }
.pay-row button { flex: none; }
.slip-wrap { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.slip-head span { display: inline-flex; align-items: center; gap: 6px; }
.slip-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 13px; color: var(--ink-2); }
.giro { display: flex; gap: 16px; align-items: center; margin-top: 14px; }
.giro .qr { width: 132px; height: 132px; border: 1px solid var(--line); border-radius: 10px; flex: none; }
.made-with {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 40px auto 0;
  padding: 12px 16px;
  max-width: 460px;
  border-radius: 14px;
  border: 1px dashed var(--line-2);
  color: var(--ink-2);
  font-size: 13.5px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.made-with:hover { border-color: var(--ink-3); background: var(--surface); }
.made-with img { width: 22px; height: 22px; }
.made-with b { color: var(--ink); font-weight: 600; }
.doc-bar { display: none; }
.mobile-secondary { display: none !important; }
#pay { scroll-margin-top: 84px; }
.doc-card h2 .i { display: inline-block; vertical-align: -2px; margin-right: 4px; color: var(--violet); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--ink-2); }
.chip:hover, .chip.on { border-color: var(--ink); color: var(--ink); }
.contact-list { display: grid; gap: 8px; }
.contact-list a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; font-weight: 550; }
.contact-list a:hover { border-color: var(--ink-3); background: var(--surface-2); }
.contact-list small { display: block; color: var(--ink-3); font-weight: 400; font-size: 12.5px; }
.accept-sum { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 16px; }
.accept-sum strong { font-size: 22px; letter-spacing: -0.02em; font-feature-settings: "tnum"; }
.demo-ribbon { background: var(--ink); color: #fff; font-size: 13px; text-align: center; padding: 8px 16px; }
.demo-ribbon a { color: #fff; font-weight: 600; }

@media (max-width: 960px) {
  .doc-grid { grid-template-columns: 1fr; }
  .doc-aside { position: static; }
  .doc-aside .doc-card.primary { display: none; }
  .mobile-secondary { display: flex !important; }
  .doc-page { padding: 16px 12px 130px; }
  .doc-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -10px 30px -18px rgba(0, 0, 0, 0.25);
  }
  .doc-bar .sum { font-size: 12px; color: var(--ink-3); line-height: 1.25; }
  .doc-bar .sum strong { display: block; font-size: 19px; color: var(--ink); letter-spacing: -0.02em; font-feature-settings: "tnum"; }
  .doc-bar .btn { flex: 1; max-width: 240px; }
}

/* ================= Print ================= */
.print-only, .qr-sheet { display: none; }
.print-measure { position: absolute !important; left: -10000px; top: 0; width: 210mm !important; font-size: 9.6pt !important; padding: 16mm 18mm 12mm !important; border: 0 !important; box-shadow: none !important; border-radius: 0 !important; visibility: hidden; }

@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff !important; }
  body { min-height: 0; }
  .no-print, .doc-top, .doc-aside, .doc-bar, .doc-state, .pay-card, .made-with, .demo-ribbon, .toasts { display: none !important; }
  .doc-page { padding: 0 !important; max-width: none; }
  .doc-grid { display: block; }
  .paper {
    width: 210mm;
    min-height: 297mm;
    font-size: 9.6pt;
    padding: 16mm 18mm 12mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
  }
  .paper .stamp { mix-blend-mode: normal; background: transparent; }
  .lines .ln-unit, .lines th:nth-child(3) { display: table-cell !important; }
  .opt-box { display: none; }
  tr.opt td { background: transparent !important; }
  body.qr-same .paper { padding-bottom: 112mm; }
  body.qr-same .paper .qr-slot { display: block; position: absolute; left: 0; bottom: 0; width: 210mm; height: 105mm; }
  body.qr-own .qr-sheet { display: block; position: relative; width: 210mm; height: 297mm; break-before: page; page-break-before: always; }
  body.qr-own .qr-sheet .qr-slot { display: block; position: absolute; left: 0; bottom: 0; width: 210mm; height: 105mm; }
  .qr-slot .qrbill { width: 210mm; height: 105mm; }
  .print-only { display: block; }
}
.qr-slot { display: none; }
