/* Farben aus dem CAS-Brand (UI-Design 3.1); im Markup keine rohen Hex-Werte. */
:root {
  --blau: #005aab;
  --dunkelblau: #003f7d;
  --cyan: #0090d4;
  --text: #1c2430;
  --grau: #3f4954;
  --grau-hell: #63717f;
  --grau-aus: #94a1ad;
  --linie: #d2dce6;
  --grund: #eef4fb;
  /* CAS-Positiv #3a8955 abgedunkelt für WCAG AA bei Text */
  --erfolg: #2f7547;
  --platzhalter: #e2e9f1;
  --feld: #f7f9fc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, "Segoe UI", sans-serif;
}

:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* Kopfleiste (UI-Design 3.4); Brand: Logo mindestens 120 px breit, Seitenverhältnis 3,24:1 */
.bar { background: var(--blau); color: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.bar .t { font-weight: 700; font-size: 18px; }
.bar .m { font-size: 13px; opacity: .85; margin-top: 2px; }
.bar img { width: 120px; height: auto; display: block; }

/* 404-Seite und Startseite */
.nf { max-width: 480px; margin: 0 auto; padding: 40px 28px; text-align: center; }
.nf h1 { font-size: 21px; color: var(--dunkelblau); margin: 18px 0 8px; }
.nf p { font-size: 14.5px; color: var(--grau); line-height: 1.55; margin: 0 0 10px; }
.nf ul { text-align: left; font-size: 14px; color: var(--grau); line-height: 1.6; background: #fff; border-radius: 14px; padding: 14px 18px 14px 34px; margin: 18px 0 0; box-shadow: 0 4px 14px rgba(0, 63, 125, .08); }
/* --grau-hell statt --grau-aus: #94a1ad auf dem Seitengrund hat nur etwa 2,4:1 (WCAG AA verlangt 4,5:1). */
.nf .code { font-size: 12px; color: var(--grau-hell); margin-top: 22px; }

/* zerrissener Bon */
.torn { width: 150px; height: 150px; margin: 0 auto 6px; position: relative; }
.torn .p { position: absolute; top: 10px; width: 62px; height: 120px; background: #fff; box-shadow: 0 6px 14px rgba(28, 36, 48, .12); }
.torn .l { left: 12px; transform: rotate(-8deg); clip-path: polygon(0 0, 100% 0, 88% 12%, 100% 25%, 86% 38%, 100% 52%, 88% 66%, 100% 80%, 90% 92%, 100% 100%, 0 100%); }
.torn .r { right: 12px; transform: rotate(7deg); clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12% 90%, 0 78%, 14% 64%, 0 50%, 12% 36%, 0 22%, 10% 10%); }
.torn .p i { display: block; height: 6px; background: var(--platzhalter); border-radius: 3px; margin: 12px 10px; }

/* „Bon folgt“ (UI-Design 5) */
.folgt { max-width: 480px; margin: 0 auto; padding-bottom: 12px; }
.folgt .stage { padding: 26px 24px 6px; text-align: center; }
.folgt .stage h1 { font-size: 19px; color: var(--dunkelblau); margin: 12px 0 6px; }
.folgt .stage p { font-size: 14px; color: var(--grau); line-height: 1.5; margin: 0 0 14px; }
.folgt .card { margin: 14px 12px 0; background: #fff; border-radius: 14px; padding: 14px 16px; box-shadow: 0 4px 14px rgba(0, 63, 125, .08); }
.folgt .stage + .card { margin-top: 0; }
.folgt .note { font-size: 12.5px; color: var(--grau-hell); text-align: center; line-height: 1.5; margin: 0; padding: 16px 24px 16px; }

/* Drucker: Schlitz, aus dem ein Bon mit Reißkante herausfährt (3,2 s je Durchlauf) */
.printer { position: relative; width: 160px; height: 118px; margin: 0 auto; }
.slot { position: absolute; left: 8px; right: 8px; top: 0; height: 26px; border-radius: 9px; background: var(--blau); box-shadow: inset 0 -6px 0 var(--dunkelblau); z-index: 2; }
.slip { position: absolute; left: 28px; right: 28px; top: 18px; height: 0; overflow: hidden; padding: 0 10px; background: #fff; box-shadow: 0 6px 14px rgba(28, 36, 48, .12); animation: print 3.2s ease-in-out infinite;
  mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 14px 51% repeat-x,
        conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 51% repeat-x; }
.slip::before { content: ""; display: block; height: 14px; }
.slip .sk { height: 6px; margin: 8px 0; border-radius: 6px; background: var(--platzhalter); }
@keyframes print { 0% { height: 0; } 70% { height: 96px; } 100% { height: 96px; opacity: 0; } }

/* Fortschritt: läuft in genau 10 s voll und beginnt mit dem Neuladen von vorn */
.tick { height: 4px; background: var(--linie); border-radius: 2px; overflow: hidden; }
.tick i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--blau), var(--cyan)); transform-origin: left; animation: fill 10s linear forwards; }
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.hint { font-size: 12.5px; color: var(--grau-hell); margin-top: 8px; display: flex; justify-content: space-between; }

/* Link kopieren und teilen (UI-Design 4.4) */
.later h2 { margin: 0 0 4px; font-size: 16px; color: var(--dunkelblau); display: flex; align-items: center; gap: 8px; }
.later h2 svg { width: 20px; height: 20px; flex: none; color: var(--blau); }
.later p { margin: 0 0 12px; font-size: 13.5px; color: var(--grau); line-height: 1.45; }
.copy { display: flex; border: 1.5px solid var(--linie); border-radius: 10px; overflow: hidden; background: var(--feld); }
.copy input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 11px 10px; font-family: "DejaVu Sans Mono", Consolas, "Liberation Mono", monospace; font-size: 12.5px; color: var(--grau); text-overflow: ellipsis; }
.copy button { display: flex; align-items: center; gap: 6px; min-height: 44px; border: 0; border-left: 1.5px solid var(--linie); background: #fff; color: var(--blau); font: inherit; font-weight: 700; font-size: 14px; padding: 0 14px; cursor: pointer; }
.copy svg { width: 18px; height: 18px; flex: none; }
.copy :focus-visible { outline-offset: -3px; }
.copy .ic-ok { display: none; }
.copy.done { border-color: var(--erfolg); }
.copy.done button { background: var(--erfolg); color: #fff; border-left-color: var(--erfolg); }
.copy.done .ic-ok { display: block; }
.copy.done .ic-copy { display: none; }
.copied { font-size: 12.5px; font-weight: 700; color: var(--erfolg); margin-top: 6px; }
.copied.fail { color: var(--grau); }
.copied:empty { margin: 0; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; margin-top: 10px; padding: 12px 0; border: 2px solid var(--blau); border-radius: 12px; background: #fff; color: var(--blau); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; }
.btn svg { width: 19px; height: 19px; flex: none; }

/* Bon-Seite (UI-Design 4); eine Kopie der Schrift, das PDF bettet dieselbe Datei ein. */
@font-face { font-family: "DejaVu Sans Mono"; src: url('/fonts/DejaVuSansMono.ttf') format('truetype'); font-display: swap; }

/* Seitenränder wachsen mit, damit Knöpfe und Feld auf breiten Schirmen bündig mit dem Papier (max. 480 px) bleiben. */
.fest { position: sticky; top: 0; z-index: 2; box-shadow: 0 2px 10px rgba(0, 63, 125, .18); }
.btns, #weiterleiten { padding-inline: max(12px, calc((100% - 456px) / 2)); }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-block: 12px; background: #fff; border-bottom: 1px solid var(--linie); }
.btns .btn { margin-top: 0; text-decoration: none; }
.btn.pri { background: var(--blau); color: #fff; }
.btn .chev { width: 16px; height: 16px; margin-left: -2px; }
.btn[aria-expanded="true"] { background: var(--grund); }
.btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
#weiterleiten { background: #fff; padding-top: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--linie); }

.bonseite { max-width: 480px; margin: 0 auto; }
.paper { margin: 18px 12px 8px; background: #fff; padding: 26px 12px 30px; container-type: inline-size; box-shadow: 0 6px 18px rgba(28, 36, 48, .12);
  mask: conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / 14px 51% repeat-x,
        conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / 14px 51% repeat-x; }
.bon { margin: 0; font-family: "DejaVu Sans Mono", Consolas, "Liberation Mono", monospace; line-height: 1.45; color: var(--text);
  font-size: clamp(11px, calc(100cqw / (var(--cols) * 0.602)), 16px); white-space: pre; overflow-x: auto; }
.foot { margin: 0; text-align: center; font-size: 12px; color: var(--grau-hell); padding: 18px 16px 28px; }

/* Sonst überstimmt `display: flex` von .btn das Attribut `hidden` („Teilen …“ ohne navigator.share). */
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .slip { height: 96px; }
}
