:root {
  --tisch: #6b6e66;
  --papier: #f5f3ea;
  --tinte: #1c1c1a;
  --linie: #2a2a27;
  --tint: #e2eadb;
  --grau: #5a5a55;
  --rot: #b3261e;
  --gruen: #1d6a3a;
  --kuli: #1f3a93;
  --marker: #fff3a6;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--tisch);
  background-image:
    radial-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    radial-gradient(rgba(0,0,0,.06) 1px, transparent 1px);
  background-size: 3px 3px, 5px 5px;
  background-position: 0 0, 1px 2px;
  color: var(--tinte);
  font-family: "Archivo Narrow", "Arial Narrow", Arial, sans-serif;
  padding: 28px 12px 60px;
}

/* ---------- Blatt ---------- */

.blatt {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  background: var(--papier);
  padding: 36px 48px 28px 64px;
  box-shadow: 0 1px 1px rgba(0,0,0,.25), 0 10px 30px rgba(0,0,0,.35);
  transform: rotate(-0.25deg);
}

.blatt::before,
.blatt::after {
  content: "";
  position: absolute;
  left: 20px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--tisch);
  box-shadow: inset 0 2px 3px rgba(0,0,0,.45);
}
.blatt::before { top: 28%; }
.blatt::after  { top: 68%; }

.blatt.wackeln { animation: wackeln .35s ease-out; }
@keyframes wackeln {
  0%   { transform: rotate(-0.25deg) translateY(0); }
  30%  { transform: rotate(-0.25deg) translateY(4px); }
  60%  { transform: rotate(-0.25deg) translateY(-1px); }
  100% { transform: rotate(-0.25deg) translateY(0); }
}

/* ---------- Briefkopf ---------- */

.briefkopf {
  display: grid;
  grid-template-columns: 92px 1fr 190px;
  gap: 18px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 3px double var(--linie);
}

.siegel { width: 92px; height: 92px; color: var(--tinte); }

.amt-name {
  font-weight: 700;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.1;
  margin-bottom: 4px;
}
.amt-abt { font-size: 14px; }
.amt-klein { font-size: 12px; color: var(--grau); margin-top: 4px; }

.eingang { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.eingang-titel { color: var(--grau); }
.eingang-feld {
  height: 64px;
  border: 1px dashed var(--grau);
  margin: 3px 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.eingangsstempel {
  font-family: "Special Elite", monospace;
  color: var(--kuli);
  border: 2px solid currentColor;
  padding: 3px 8px;
  text-align: center;
  font-size: 11px;
  line-height: 1.25;
  transform: rotate(-6deg);
  opacity: .85;
  mix-blend-mode: multiply;
  animation: stempeln .3s cubic-bezier(.2,1.6,.4,1);
}
.eingangsstempel b { font-size: 14px; display: block; letter-spacing: .08em; }

/* ---------- Formularkopf ---------- */

.formkopf {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: end;
  margin-top: 22px;
}

.formnr {
  font-weight: 700;
  font-size: 13px;
  border: 1.5px solid var(--linie);
  padding: 6px 8px;
  line-height: 1.3;
}
.formnr span { font-weight: 400; color: var(--grau); }

h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 700;
}

.hinweis {
  font-size: 14px;
  margin: 14px 0 0;
  max-width: 560px;
}

/* ---------- Post-it ---------- */

.postit {
  position: absolute;
  top: 150px;
  right: -46px;
  width: 170px;
  padding: 14px 14px 18px;
  background: #fde97a;
  font-family: "Caveat", cursive;
  font-size: 19px;
  line-height: 1.15;
  color: #2a2a2a;
  transform: rotate(4deg);
  box-shadow: 0 6px 10px -4px rgba(0,0,0,.35);
  z-index: 2;
}
.postit strong { font-weight: 700; }

/* ---------- Abschnitte & Felder ---------- */

.abschnitt {
  border: 1.5px solid var(--linie);
  margin: 18px 0 0;
  padding: 0;
  min-width: 0;
}

.abschnitt > legend {
  float: left;
  width: 100%;
  padding: 6px 10px;
  margin: 0;
  background: var(--tint);
  border-bottom: 1.5px solid var(--linie);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.abschnitt > legend + * { clear: both; }

.feld {
  display: grid;
  grid-template-columns: 36px 1fr;
  border-bottom: 1px solid var(--linie);
  transition: background .2s;
}
.feld:last-child { border-bottom: 0; }

.nr {
  border-right: 1px solid var(--linie);
  background: var(--tint);
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  padding-top: 8px;
}

.inhalt { padding: 7px 12px 11px; min-width: 0; }

.zweispaltig { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.titel {
  display: block;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #3b3b37;
  margin-bottom: 5px;
}

.klein { font-size: 12.5px; color: var(--grau); font-family: "Archivo Narrow", sans-serif; }

.getippt,
input[type="text"],
input[type="time"],
input[type="number"],
select,
textarea {
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 18px;
  color: #17173a;
}

input[type="text"],
input[type="time"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px dotted #555;
  border-radius: 0;
  padding: 3px 2px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
textarea {
  border: 1px dotted #555;
  resize: vertical;
  margin-top: 6px;
  line-height: 1.35;
}
select {
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--tinte) 50%), linear-gradient(135deg, var(--tinte) 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 24px;
}
input.kurz { width: 160px; }

input:focus,
select:focus,
textarea:focus { background-color: var(--marker); }

.berechnung {
  font-family: "Courier Prime", monospace;
  font-size: 14px;
  margin-top: 6px;
  color: var(--grau);
}
.berechnung b { color: var(--tinte); }

/* Kästchen zum Ankreuzen */

.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 4px 0;
  font-size: 16px;
  line-height: 1.3;
  cursor: pointer;
}

.option input {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  border: 1.5px solid var(--linie);
  background: #fff;
  display: grid;
  place-content: center;
  cursor: pointer;
}
.option input:checked::after {
  content: "X";
  font-family: "Courier Prime", monospace;
  font-weight: 700;
  font-size: 17px;
  line-height: 1;
  color: #17173a;
  transform: translateY(-1px);
}
.option input:focus-visible { outline: 2px solid var(--kuli); outline-offset: 2px; }
.option input:disabled { background: #e6e4dc; border-color: #aaa; cursor: not-allowed; }
.option input:disabled + span { color: #888; cursor: not-allowed; }

/* AZB */

.azb {
  height: 130px;
  overflow-y: auto;
  border: 1px solid var(--linie);
  background: #fbfaf5;
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.45;
  margin-bottom: 8px;
}
.azb p { margin: 0 0 8px; }

/* Unterschrift */

.unterschrift-wrap {
  position: relative;
  margin-top: 12px;
  height: 110px;
}
#unterschrift {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  z-index: 1;
}
.unterschrift-linie {
  position: absolute;
  left: 0; right: 0; bottom: 18px;
  border-bottom: 1px solid var(--linie);
}
.unterschrift-linie span {
  position: absolute;
  left: 2px;
  bottom: 2px;
  font-family: "Courier Prime", monospace;
  font-size: 18px;
  color: var(--grau);
}
.unterschrift-fuss { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }

.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--kuli);
  text-decoration: underline;
  cursor: pointer;
}

/* Gebühr */

.gebuehr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 10px 12px;
  border: 1.5px solid var(--linie);
  background: repeating-linear-gradient(-45deg, transparent 0 7px, rgba(0,0,0,.035) 7px 8px);
}
.gebuehr .titel { margin-bottom: 2px; }
.gebuehr-betrag {
  font-family: "Courier Prime", monospace;
  font-weight: 700;
  font-size: 24px;
  white-space: nowrap;
  border: 1.5px solid var(--linie);
  background: var(--papier);
  padding: 4px 12px;
}

/* Absenden */

.absenden { margin-top: 22px; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }

.knopf {
  font-family: "Archivo Narrow", sans-serif;
  font-weight: 700;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--tinte);
  color: var(--papier);
  border: 1.5px solid var(--tinte);
  padding: 14px 22px;
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.knopf:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--grau); }
.knopf:active { transform: translate(0, 0); box-shadow: none; }
.knopf.sekundaer { background: transparent; color: var(--tinte); }
.knopf.rot { background: var(--rot); border-color: var(--rot); }

.ausfertigung {
  font-family: "Courier Prime", monospace;
  font-size: 14.5px;
  border-left: 4px solid var(--tinte);
  background: #ecebe2;
  padding: 10px 14px;
  max-width: 520px;
  align-self: stretch;
  margin-left: auto;
}
.ausfertigung b { font-family: "Archivo Narrow", sans-serif; text-transform: uppercase; letter-spacing: .04em; display: block; margin-bottom: 4px; }

/* Beanstandung */

.beanstandung {
  margin-top: 18px;
  border: 2px solid var(--rot);
  color: var(--rot);
  padding: 10px 14px 6px;
  font-family: "Courier Prime", monospace;
  font-size: 14.5px;
  position: relative;
}
.beanstandung p { margin: 0 0 6px; }
.beanstandung ul { margin: 0 0 6px; padding-left: 20px; }
.beanstandung li { margin-bottom: 3px; }
.beanstandung-titel {
  font-family: "Special Elite", monospace;
  font-size: 22px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.feld.fehler { background: rgba(179, 38, 30, .08); }
.feld.fehler .nr { background: var(--rot); color: #fff; }

/* ---------- Bearbeitung ---------- */

.warteraum {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 28px;
  margin-top: 24px;
  align-items: start;
}

.ticket {
  background: #fff;
  padding: 14px 14px 16px;
  text-align: center;
  font-family: "Courier Prime", monospace;
  transform: rotate(-2deg);
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
  -webkit-mask: radial-gradient(circle 5px at 50% 0, transparent 98%, #000) top / 14px 51% repeat-x,
                radial-gradient(circle 5px at 50% 100%, transparent 98%, #000) bottom / 14px 51% repeat-x;
          mask: radial-gradient(circle 5px at 50% 0, transparent 98%, #000) top / 14px 51% repeat-x,
                radial-gradient(circle 5px at 50% 100%, transparent 98%, #000) bottom / 14px 51% repeat-x;
}
.ticket-kopf { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; border-bottom: 1px dashed #999; padding: 4px 0 8px; margin-bottom: 8px; }
.ticket-label { font-size: 11px; text-transform: uppercase; color: var(--grau); margin-top: 6px; }
.ticket-nr { font-size: 62px; font-weight: 700; line-height: 1; }
.ticket-aufgerufen { font-size: 26px; font-weight: 700; color: var(--rot); }
.ticket-fuss { font-size: 11px; color: var(--grau); border-top: 1px dashed #999; margin-top: 10px; padding-top: 8px; }

.protokoll {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  font-family: "Courier Prime", monospace;
  font-size: 14.5px;
  min-height: 220px;
}
.protokoll li { padding: 3px 0; border-bottom: 1px dotted #bbb; display: grid; grid-template-columns: 54px 1fr; gap: 8px; }
.protokoll li time { color: var(--grau); }
.protokoll li.aktiv span::after { content: "▌"; animation: blinken 1s steps(1) infinite; margin-left: 2px; }
@keyframes blinken { 50% { opacity: 0; } }

.balken { border: 1.5px solid var(--linie); height: 22px; background: #fff; }
#balken-fuellung {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(45deg, var(--tinte) 0 5px, transparent 5px 10px);
  transition: width .7s ease-in-out;
}
#balken-text { font-family: "Courier Prime", monospace; margin-top: 4px; }

/* ---------- Bescheid ---------- */

.bescheid-kopf {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 24px;
  margin-top: 26px;
  font-size: 14px;
}
.anschrift { font-family: "Courier Prime", monospace; font-size: 16px; line-height: 1.4; }
.anschrift .klein { display: block; margin-bottom: 6px; text-decoration: underline; }
.zeichen-tabelle { width: 100%; border-collapse: collapse; font-size: 13px; }
.zeichen-tabelle td { padding: 2px 0; vertical-align: top; }
.zeichen-tabelle td:first-child { color: var(--grau); width: 92px; }

.bescheid-titel {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: .3em;
  text-transform: uppercase;
  margin: 32px 0 4px;
}
.betreff { font-weight: 700; font-size: 16px; margin: 0 0 18px; }

.brieftext {
  font-family: "Courier Prime", monospace;
  font-size: 16px;
  line-height: 1.5;
}
.brieftext p { margin: 0 0 12px; }
.brieftext ol { margin: 0 0 14px; padding-left: 26px; }
.brieftext li { margin-bottom: 6px; }
.brieftext h3 {
  font-family: "Archivo Narrow", sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 20px 0 6px;
}

.tenor {
  position: relative;
  margin: 6px 0 10px;
  padding: 18px 0;
  min-height: 150px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stempel {
  display: inline-block;
  font-family: "Special Elite", monospace;
  color: var(--rot);
  border: 5px solid currentColor;
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 4px;
  padding: 8px 22px 6px;
  text-align: center;
  text-transform: uppercase;
  font-size: 50px;
  line-height: 1;
  letter-spacing: .07em;
  transform: rotate(-8deg);
  opacity: .88;
  mix-blend-mode: multiply;
  animation: stempeln .35s cubic-bezier(.2,1.6,.4,1) both;
}
.stempel small { display: block; font-size: 17px; letter-spacing: .15em; margin-top: 6px; }
.stempel.gruen { color: var(--gruen); }

@keyframes stempeln {
  0%   { transform: rotate(-8deg) scale(2.4); opacity: 0; }
  70%  { transform: rotate(-8deg) scale(.96); opacity: .95; }
  100% { transform: rotate(-8deg) scale(1); opacity: .88; }
}

.gez {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}
.gez-unterschrift svg { width: 180px; height: 50px; color: var(--kuli); display: block; }
.gez-unterschrift div { font-size: 13px; border-top: 1px solid var(--linie); padding-top: 3px; width: 200px; }
.gez-gebuehr { font-family: "Courier Prime", monospace; font-size: 15px; text-align: right; }

.belehrung {
  margin-top: 26px;
  padding-top: 10px;
  border-top: 1px solid var(--linie);
  font-size: 12.5px;
  color: var(--grau);
}
.belehrung b { color: var(--tinte); text-transform: uppercase; letter-spacing: .04em; }

.aktionen {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}
.kopiert { font-family: "Courier Prime", monospace; font-size: 14px; align-self: center; color: var(--gruen); }

/* ---------- Fuß ---------- */

.fuss {
  margin-top: 32px;
  padding-top: 8px;
  border-top: 1px solid var(--linie);
  font-size: 11px;
  color: var(--grau);
  text-align: center;
}

/* ---------- Mobil ---------- */

@media (max-width: 980px) {
  .postit { position: static; transform: rotate(-1.5deg); width: auto; max-width: 280px; margin: 16px 0 0 auto; }
}

@media (max-width: 640px) {
  body { padding: 10px 6px 40px; }
  .blatt { padding: 22px 16px 20px 34px; transform: none; }
  .blatt::before, .blatt::after { left: 9px; width: 12px; height: 12px; }
  .blatt.wackeln { animation: none; }
  .briefkopf { grid-template-columns: 64px 1fr; gap: 12px; }
  .siegel { width: 64px; height: 64px; }
  .amt-name { font-size: 17px; }
  .amt-abt { font-size: 12.5px; }
  .eingang { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: 0 10px; align-items: center; }
  .eingang-feld { grid-row: span 2; grid-column: 2; height: 54px; }
  .formkopf { grid-template-columns: 1fr; gap: 10px; }
  .formnr { justify-self: start; }
  h1 { font-size: 21px; }
  .zweispaltig { grid-template-columns: 1fr; }
  .warteraum { grid-template-columns: 1fr; }
  .ticket { max-width: 220px; margin: 0 auto; }
  .ticket-nr { font-size: 48px; }
  .warteraum { gap: 18px; margin-top: 16px; }
  .bescheid-kopf { grid-template-columns: 1fr; }
  .bescheid-titel { font-size: 24px; letter-spacing: .2em; }
  .stempel { font-size: 34px; }
  .stempel small { font-size: 13px; }
  .gebuehr { flex-direction: column; align-items: flex-start; }
  .absenden { align-items: stretch; }
  .knopf { width: 100%; }
  .aktionen .knopf { width: 100%; }
}
