/* WINKELHOCK Auftrag/Rechnung — Papierformular 1:1 + Werkbank-Rahmen */

@font-face {
  font-family: "Barlow Condensed";
  src: url("assets/fonts/barlow-condensed-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow Condensed";
  src: url("assets/fonts/barlow-condensed-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow Condensed";
  src: url("assets/fonts/barlow-condensed-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow Condensed";
  src: url("assets/fonts/barlow-condensed-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow";
  src: url("assets/fonts/barlow-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow";
  src: url("assets/fonts/barlow-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow";
  src: url("assets/fonts/barlow-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #141414;
  --ink-soft: #3a3a3a;
  --red: #c10f24;
  --red-deep: #9a0c1c;
  --paper: #f7f4ea;
  --paper-line: #2c2c2c;
  --grid: #6e6e6e;
  --desk: #1b1d1c;
  --desk-2: #2a2f2c;
  --brass: #c4a574;
  --wowobot: #22b8e0;
  --ok: #1f7a4d;
  --danger: #c10f24;
  --header-h: 64px;
  --z-header: 50;
  --z-nav: 60;
  --z-modal: 80;
  --paper-w: 210mm;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Barlow, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(1200px 500px at 10% -10%, #3a3228 0%, transparent 55%),
    radial-gradient(900px 400px at 110% 0%, #243028 0%, transparent 50%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.015) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, var(--desk) 0%, #121413 100%);
  min-height: 100vh;
}

/* Komplettes Auftragblatt: schmale Werkbank-Leiste, Blatt füllt den Rest */
body.app-blatt {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Werkbank = Ablageleiste + Blatt nebeneinander. Nur dieser Streifen scrollt,
   Kopf- und Fußzeile bleiben stehen. */
body.app-blatt .werkbank {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: stretch;
}

body.app-blatt .desk {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

/* —— Ergebnis der KoSIT-Prüfung im XRechnung-Dialog —— */
.pruefung {
  max-height: 190px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid;
  border-radius: 8px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.45;
}

.pruefung.ist-ok {
  border-color: rgba(31, 122, 77, 0.45);
  background: rgba(31, 122, 77, 0.08);
  color: #14532d;
}

.pruefung.ist-fehler {
  border-color: rgba(193, 15, 36, 0.45);
  background: rgba(193, 15, 36, 0.07);
  color: #7f1020;
}

.pruef-kopf {
  margin: 0;
  font-weight: 700;
}

.pruef-hinweis {
  margin: 8px 0 2px;
  font-weight: 600;
}

.pruef-quelle {
  margin: 5px 0 0;
  opacity: 0.75;
  font-size: 11.5px;
  line-height: 1.4;
}

.pruef-punkt {
  margin: 4px 0 0;
  padding-left: 2px;
  font-size: 12.5px;
}

/* —— Ablageleiste —— */
.ablage {
  flex: 0 0 302px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 18px;
  background: #171918;
  border-right: 1px solid rgba(196, 165, 116, 0.22);
  color: #d8d0c4;
  font-size: 13px;
}

body.ablage-zu .ablage {
  display: none;
}

.ablage-block + .ablage-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.ablage h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f3efe6;
}

.ablage-ziel {
  margin-bottom: 18px;
}

.ablage-ziel-titel {
  display: block;
  margin-bottom: 5px;
  color: #b7ae9f;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Pfade lieber umbrechen als abschneiden: der wichtigste Teil steht hinten,
   ein Ellipsis am Ende würde genau den Zielordner verstecken. direction: rtl
   wäre die übliche Alternative, verdreht aber die Slashes. */
.ablage-pfad {
  display: block;
  margin-bottom: 7px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: #0f1110;
  color: #d8d0c4;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.45;
  word-break: break-all;
}

.ablage-ziel.hat-fehler .ablage-pfad {
  border-color: #e0503f;
}

.ablage-tippen {
  width: 100%;
  min-height: 36px;
  margin-top: 7px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: #0f1110;
  color: #f3efe6;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}

.btn-klein {
  width: 100%;
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

.ablage-status {
  margin: 2px 0 0;
  color: #8fbf8a;
  font-size: 11.5px;
  line-height: 1.4;
  word-break: break-word;
}

.ablage-status.ist-fehler {
  color: #f0907f;
}


body.app-blatt .site-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 20px 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

body.app-blatt .powered {
  margin: 0;
  padding: 0;
  border: 0;
  text-align: right;
}

body.app-blatt .footer-zre {
  color: #d7d2c8;
  font-size: 13px;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

body.app-blatt .footer-zre:hover {
  color: #fff;
}

/* Zwei Zeilen: oben Marke und Werkzeuge, darunter die Behördendaten über die
   volle Breite. In einer gemeinsamen Zeile blieben für die Daten nur ein paar
   Pixel übrig – sie brächen in eine hohe Säule um und zögen den Kopf mit. */
.app-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 7px 24px;
  padding: 8px 18px;
  background: #141615;
  border-bottom: 1px solid rgba(196, 165, 116, 0.28);
}

/* Alle Angaben in einer fortlaufenden Zeile, durch Mittelpunkte getrennt.
   Wird es eng, bricht sie auf zwei Zeilen um – nichts wird abgeschnitten. */
.app-bar-buyer {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  /* Abstand statt Trennzeichen zwischen den Gruppen: ein per ::before
     gesetzter Punkt würde beim Umbruch am Anfang der zweiten Zeile landen.
     Die Angaben innerhalb einer Gruppe trennen sich ohnehin selbst. */
  gap: 2px 22px;
  min-width: 0;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: #b7ae9f;
  font-size: 12.5px;
  line-height: 1.35;
}

.app-bar-buyer strong {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f3efe6;
}

.app-bar-ids {
  color: #b7ae9f;
}

.app-bar-ids b {
  color: #f3efe6;
  font-weight: 600;
}

.app-bar-ids a {
  color: var(--brass);
  text-underline-offset: 2px;
}

.app-bar-tools {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: end;
  justify-content: flex-end;
  /* Zwei Aktionsbuttons plus Zoom und Aktenzeichen passen auf breiten Schirmen
     in eine Zeile. Wird es enger, sollen sie umbrechen statt die Behörden-
     angaben in der Mitte zusammenzuquetschen. */
  flex-wrap: wrap;
  gap: 10px;
}

.zoom-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 6px;
}

.zoom-tools button {
  width: 40px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #f3efe6;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.zoom-tools button:hover,
.zoom-tools button:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

#zoomFit {
  width: auto;
  padding: 0 10px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#zoomLabel {
  min-width: 44px;
  text-align: center;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #d7d2c8;
}

.akten-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass);
}

/* Sternchen macht sichtbar, dass das Feld gerade Pflicht ist – bei Vermittler
   „Polizei“ braucht die Behörde das Aktenzeichen zur Zuordnung. */
.akten-field.ist-pflicht > span::after {
  content: " *";
  color: var(--red);
}

.akten-field input {
  width: min(180px, 20vw);
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: #f4efe4;
  color: var(--ink);
  font-family: Barlow, sans-serif;
  font-size: 14px;
  text-transform: none;
  letter-spacing: 0;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
  z-index: 100;
  background: #fff;
  padding: 8px 12px;
}

/* —— App-Kopf —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-h);
  padding: 10px 18px;
  background: rgba(18, 20, 19, 0.92);
  border-bottom: 1px solid rgba(196, 165, 116, 0.22);
  backdrop-filter: blur(10px);
}

.brand {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  line-height: 1.05;
}

.brand-kicker {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
}

.brand-name {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: #f3efe6;
}

.nav-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: #f3efe6;
  cursor: pointer;
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: center;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  position: relative;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle span::before {
  top: -6px;
}

.nav-toggle span::after {
  top: 6px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav a {
  color: #d7d2c8;
  text-decoration: none;
  padding: 10px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.btn-primary {
  background: var(--red);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--red-deep);
}

.btn-ghost {
  background: transparent;
  color: #f3efe6;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.nav-toggle:focus-visible,
.paper input:focus-visible,
.paper textarea:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* —— Behördenleiste —— */
.authority {
  margin: 18px auto 0;
  max-width: calc(var(--paper-w) + 48px);
  padding: 0 16px;
}

.authority-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 18px;
  padding: 14px 16px;
  background: rgba(247, 244, 234, 0.08);
  border: 1px solid rgba(196, 165, 116, 0.28);
  border-radius: 10px;
  color: #efe8da;
}

.authority-card h2 {
  margin: 0 0 4px;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.authority-card p {
  margin: 0;
  font-size: 14px;
  color: #cfc6b6;
  line-height: 1.45;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border: 1px solid rgba(196, 165, 116, 0.45);
  border-radius: 999px;
  color: var(--brass);
}

.chip strong {
  color: #fff;
  font-weight: 600;
}

.authority-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

/* Blatt-Layout liegt in form-sheet.css */


/* Modal */
.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(10, 12, 11, 0.72);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-card {
  width: min(640px, 100%);
  /* Mit XML-Vorschau plus Prüfergebnis wird der Dialog schnell höher als der
     Bildschirm – dann muss er in sich scrollen, sonst sind die Knöpfe unten
     nicht mehr erreichbar. */
  max-height: 92dvh;
  overflow: auto;
  background: #f7f4ea;
  color: var(--ink);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.modal-card h2 {
  margin: 0 0 8px;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 26px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.xml-preview {
  width: 100%;
  min-height: 140px;
  max-height: 240px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  background: #1b1d1c;
  color: #e8e0d0;
  border: 0;
  border-radius: 8px;
  padding: 10px;
}

.status {
  margin-top: 8px;
  font-size: 14px;
}

.status.ok {
  color: var(--ok);
}

.status.err {
  color: var(--danger);
}

.consent {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 12px;
  font-size: 13px;
}

.consent input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
  accent-color: var(--red);
}

/* Legal pages */
.legal-page {
  max-width: 760px;
  margin: 32px auto 64px;
  padding: 28px;
  background: var(--paper);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.legal-page h1 {
  font-family: "Barlow Condensed", sans-serif;
  font-size: 34px;
  margin: 0 0 12px;
}

/* Footer */
.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 28px 18px 18px;
  color: #cfc6b6;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 14px;
}

.footer-links a {
  color: #d7d2c8;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.powered {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  text-align: right;
  font-size: 13px;
  color: #b9b2a6;
}

.powered a {
  color: var(--wowobot);
  text-decoration: none;
  font-weight: 600;
}

@media (max-width: 900px) {
  /* Auf schmalen Schirmen legt sich die Ablage über das Blatt statt es
     plattzudrücken – der Umschalter in der Kopfzeile blendet sie ein. */
  .ablage {
    position: fixed;
    inset: auto 0 0 0;
    top: 0;
    z-index: 40;
    flex-basis: auto;
    width: min(320px, 88vw);
    border-right: 1px solid rgba(196, 165, 116, 0.28);
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.5);
  }

  body:not(.ablage-offen) .ablage {
    display: none;
  }

  .app-bar {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }

  .akten-field input {
    width: 140px;
  }

  .app-bar-tools {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .zoom-tools {
    width: 100%;
    justify-content: flex-end;
    margin: 0;
  }

  .powered {
    text-align: center;
  }

  body.app-blatt .site-footer {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 8px 12px 10px;
  }

  body.app-blatt .powered {
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
    animation: none !important;
  }
}
