/* Claw Labs Factory – Basis-Stylesheet. Systemschriften, hell/dunkel, ohne externe Ressourcen. */
:root {
  color-scheme: light dark;
  --bg: #f8f7f4;
  --surface: #ffffff;
  --text: #1c1c1f;
  --muted: #55565f;
  --border: #dedbd4;
  --accent: #0b6b66;
  --accent-text: #ffffff;
  --accent-soft: #e2f1ef;
  --focus: #b54708;
  --danger: #b42318;
  --radius: 0.75rem;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111214;
    --surface: #1a1c1f;
    --text: #ececee;
    --muted: #a9abb3;
    --border: #2f3236;
    --accent: #5ccac1;
    --accent-text: #0b1513;
    --accent-soft: #15302d;
    --focus: #f7b267;
    --danger: #f97066;
    --shadow: none;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--font);
  min-height: 100vh;
  overflow-wrap: break-word;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

.wrap { width: min(100% - 2rem, 60rem); margin-inline: auto; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--focus);
  border-radius: 0.5rem;
  z-index: 10;
}
.skip-link:focus { top: 1rem; }

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 3.75rem; }
.brand { font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.brand::before {
  content: "";
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  margin-right: 0.5em;
  border-radius: 0.2em;
  background: var(--accent);
  vertical-align: 0.02em;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; -webkit-hyphens: auto; hyphens: auto; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.75rem); margin: 0 0 0.75rem; }
h2 { font-size: 1.35rem; margin: 2rem 0 0.75rem; }
p, li { max-width: 68ch; }

.hero { padding: clamp(2.5rem, 7vw, 4.5rem) 0 1.5rem; }
.lead { font-size: 1.2rem; color: var(--muted); margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 3vw, 2rem);
  margin: 1.5rem 0;
}
.card > h2:first-child { margin-top: 0; }

label { display: block; font-weight: 600; margin-bottom: 0.4rem; }
textarea, input, select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.65rem 0.75rem;
}
textarea { resize: vertical; min-height: 8rem; }
.hint { color: var(--muted); font-size: 0.95rem; margin: 0.4rem 0 0; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
}
.button.secondary { background: transparent; color: var(--accent); border-color: var(--accent); }

.result {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}
.result li {
  background: var(--accent-soft);
  border-radius: 0.6rem;
  padding: 0.75rem 1rem;
}
.result .value { display: block; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.result .label { color: var(--muted); font-size: 0.9rem; }

.steps { padding-left: 1.25rem; }
.steps li { margin: 0.35rem 0; }

code, pre { font-family: var(--mono); font-size: 0.92em; }
pre { overflow-x: auto; padding: 0.9rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 0.5rem; }

/* Breite Tabellen: <div class="table-wrap" tabindex="0" role="region" aria-label="…"><table>…</table></div> */
.table-wrap { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--border); border-radius: 0.5rem; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { background: var(--surface); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }

.notice {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  padding: 0.9rem 1.1rem;
  border-radius: 0 0.5rem 0.5rem 0;
}

.legal { padding: 2.5rem 0 1rem; }
.legal h1 { font-size: clamp(1.6rem, 6.5vw, 2rem); }
.legal a { overflow-wrap: anywhere; }
.legal h2 { font-size: 1.15rem; margin-top: 1.75rem; }
.legal-meta { color: var(--muted); font-size: 0.9rem; margin-top: 2.5rem; }

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.legal-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; padding: 0; margin: 0 0 0.75rem; }
.legal-links a { color: var(--muted); }
.legal-links a[aria-current="page"] { color: var(--text); font-weight: 600; }
.fine { margin: 0; font-size: 0.875rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .skip-link { display: none; }
  body { background: #fff; color: #000; }
}

/* ---------- Überweisungs-QR in Serie ---------- */
.site-header .wrap { flex-wrap: wrap; gap: 0.25rem 1rem; padding-block: 0.5rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--text); text-decoration: none; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.25em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.nr { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; margin-right: 0.5em; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: 0.8em; vertical-align: 0.1em; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.9rem 0 0; }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
label.button { margin: 0; }
input[type="file"].visually-hidden:focus-visible + label.button { outline: 3px solid var(--focus); outline-offset: 2px; }
.status { margin: 0.6rem 0 0; min-height: 1.2em; }
.status[data-kind="ok"] { color: var(--accent); }
.status[data-kind="warn"] { color: var(--danger); font-weight: 600; }
.grid-2, .grid-3 { display: grid; grid-template-columns: 1fr; gap: 0.75rem 1rem; margin-bottom: 0.75rem; }
@media (min-width: 40rem) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-2 .hint { margin-top: 0.25rem; }
input[type="checkbox"] { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); flex: none; }
.check { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.6rem; }
.check label { margin: 0; font-weight: 500; }
fieldset.zuordnung { border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.75rem 1rem 0.25rem; margin: 1rem 0 0; min-width: 0; }
fieldset.zuordnung legend { font-weight: 600; padding: 0 0.3rem; }
fieldset.zuordnung .check { margin: 0 0 0.75rem; }
.probleme { margin: 0.75rem 0; padding: 0.75rem 1rem; border-left: 4px solid var(--danger); background: var(--bg); border-radius: 0.4rem; font-size: 0.95rem; max-height: 18rem; overflow-y: auto; }
.probleme h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.probleme ul { margin: 0; padding-left: 1.2rem; }
.optionen { margin-top: 1rem; }
.vorschau-titel { margin: 1.75rem 0 0.5rem; font-size: 1.05rem; }
.text dt { font-weight: 700; margin-top: 0.8rem; }
.text dd { margin-left: 0; }
kbd { font-family: var(--mono); font-size: 0.9em; border: 1px solid var(--border); border-radius: 0.25rem; padding: 0 0.3em; }
.druckbogen { display: none; }

fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
.probleme li.warn { color: var(--text); }
.prose h2 { margin-top: 2rem; }
.table-wrap { overflow-x: auto; margin: 1rem 0; }
.table-wrap table { border-collapse: collapse; font-size: 0.9rem; }
.table-wrap th, .table-wrap td { border: 1px solid var(--border); padding: 0.3rem 0.5rem; text-align: left; white-space: nowrap; }
textarea#tabelle { font-family: var(--mono); font-size: 0.9rem; }

/* ---------- Rechnungsblatt (A4, Anschrift im Fenster eines DL-Umschlags) ---------- */
:root { --versatz: 0mm; }
.vorschau { display: grid; gap: 1rem; justify-items: center; }
.blatt-rahmen { width: calc(210mm * 0.42); height: calc(297mm * 0.42); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.blatt-rahmen .blatt { transform: scale(0.42); transform-origin: 0 0; }
@media (min-width: 48rem) {
  .blatt-rahmen { width: calc(210mm * 0.7); height: calc(297mm * 0.7); }
  .blatt-rahmen .blatt { transform: scale(0.7); }
}
.blatt {
  position: relative; width: 210mm; height: 297mm; overflow: hidden;
  background: #fff; color: #000; font: 10pt/1.35 Arial, Helvetica, "Liberation Sans", sans-serif;
}
.blatt p { margin: 0 0 3mm; max-width: none; }
.blatt .marke { position: absolute; left: 4mm; width: 5mm; border-top: 0.25mm solid #000; }
.blatt .falz1 { top: 105mm; }
.blatt .loch { top: 148.5mm; width: 7mm; }
.blatt .falz2 { top: 210mm; }
.blatt .kopf { position: absolute; top: 12mm; right: 20mm; width: 85mm; text-align: right; font-size: 9pt; }
.blatt .kopf strong { font-size: 12pt; }
.blatt .anschriftfeld { position: absolute; top: calc(45mm + var(--versatz)); left: 20mm; width: 85mm; height: 45mm; padding: 0 5mm; }
.blatt .ruecksende { position: absolute; top: 11mm; left: 5mm; right: 2mm; margin: 0; font-size: 7pt; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 0.2mm solid #000; }
.blatt .anschrift { position: absolute; top: 17.7mm; left: 5mm; right: 2mm; margin: 0; font-size: 10pt; line-height: 4.23mm; }
.blatt .infoblock { position: absolute; top: 50mm; left: 125mm; width: 70mm; margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.6mm 3mm; font-size: 9pt; }
.blatt .infoblock dt { color: #333; }
.blatt .infoblock dd { margin: 0; font-weight: 700; }
.blatt .inhalt { position: absolute; top: 98mm; left: 25mm; right: 20mm; }
.blatt .betreff { font-weight: 700; font-size: 11pt; margin-bottom: 6mm; }
.blatt .posten { width: 100%; border-collapse: collapse; margin: 2mm 0 5mm; }
.blatt .posten th, .blatt .posten td { padding: 1.5mm 0; text-align: left; border-bottom: 0.2mm solid #999; }
.blatt .posten tfoot th, .blatt .posten tfoot td { font-weight: 700; border-bottom: 0; border-top: 0.4mm solid #000; }
.blatt .posten .betrag { text-align: right; white-space: nowrap; }
.blatt .zahlung { display: grid; grid-template-columns: 34mm 1fr; gap: 1mm 6mm; align-items: start; margin-top: 6mm; padding-top: 4mm; border-top: 0.2mm dashed #666; }
.blatt .qr { width: 34mm; height: 34mm; display: block; }
.blatt .bank { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.6mm 3mm; font-size: 9pt; }
.blatt .bank dd { margin: 0; overflow-wrap: anywhere; }
.blatt .scan { grid-column: 1 / -1; font-size: 8pt; margin: 1mm 0 0; }
.blatt .fuss { position: absolute; bottom: 10mm; left: 25mm; right: 20mm; margin: 0; font-size: 7.5pt; color: #333; border-top: 0.2mm solid #999; padding-top: 1.5mm; }
.druck { display: none; }

@media print {
  body.drucken > *:not(#druck) { display: none !important; }
  body.drucken { display: block; min-height: 0; background: #fff; }
  body.drucken #druck { display: block; }
  #druck .blatt { break-after: page; page-break-after: always; }
  #druck .blatt:last-child { break-after: auto; page-break-after: auto; }
}

@page { size: A4; margin: 0; }

/* factory:weitere-werkzeuge */
.factory-related { margin-top: 2.5rem; padding: 1.5rem 0 0.75rem; border-top: 1px solid var(--border, currentColor); }
.factory-related h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.factory-related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.factory-related li { margin: 0; }
.factory-related li a { font-weight: 600; }
.factory-related .tagline { display: block; color: var(--muted, inherit); font-size: 0.95rem; }
.factory-related .alle { margin: 1rem 0 0; }
@media (min-width: 48rem) { .factory-related ul { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print { .factory-related { display: none; } }

/* factory:etsy-hinweis */
.factory-etsy { margin-top: 2.5rem; padding: 1.25rem 0 0.5rem; border-top: 1px solid var(--border, currentColor); }
.factory-etsy h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
.factory-etsy ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.factory-etsy li { margin: 0; }
.factory-etsy li a { font-weight: 600; }
.factory-etsy .satz { display: block; color: var(--muted, inherit); font-size: 0.95rem; }
.factory-etsy .hinweis { margin: 0.75rem 0 0; color: var(--muted, inherit); font-size: 0.85rem; }
@media print { .factory-etsy { display: none; } }
