:root {
  --orange: #e16400;
  --orange-dark: #b85200;
  --orange-soft: #fff3e8;
  --ink: #111827;
  --muted: #4b5563;
  --line: #e5e7eb;
  --bg: #f6f7f9;
  --card: #fff;
  --green: #15803d;
  --red: #b91c1c;
  --r: 8px;
}
* { box-sizing: border-box; }
html { font-family: ui-sans-serif, system-ui, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
body { margin: 0; font-size: 15px; line-height: 1.45; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 10px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Kopf */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 3px rgb(0 0 0 / .05); }
.logo { font-size: 26px; font-weight: 800; font-style: italic; letter-spacing: -1px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.logo { display: flex; align-items: flex-end; }
.logo img { height: 34px; width: auto; display: block; }
.logo small { font-size: 12px; font-style: normal; font-weight: 600; letter-spacing: 0; color: var(--muted); margin-left: 6px; text-transform: uppercase; }
#nav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
#nav a { padding: 8px 12px; border-radius: var(--r); color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; }
#nav a:hover { color: var(--orange); background: var(--orange-soft); }
#nav a.on { color: var(--orange); background: var(--orange-soft); font-weight: 700; }
#nav a b { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: var(--orange); color: #fff; font-size: 12px; text-align: center; }
#suche { width: 240px; }

main { max-width: 1900px; margin: 0 auto; padding: 24px 32px; }
/* Übersicht: Reklamationen | Bestellungen | Seitenleiste */
.ov { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.sech { margin: 18px 0 10px; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 12px; align-items: start; }
.vgrid .card { margin: 0; }
.ov .vgrid { grid-template-columns: 1fr; }
/* Listen-Seiten: Erfassung links fest, Vorgänge rechts im Raster */
.split { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 24px; align-items: start; }
.split > div:first-child { position: sticky; top: 84px; }
.split.wide { grid-template-columns: 520px minmax(0, 1fr); }
.split.wide > div:first-child { position: static; }
.sfilter { margin: 0 0 14px; }
.chip b { font-weight: 700; opacity: .75; margin-left: 2px; }
.mini { display: block; padding: 8px 10px; border-radius: var(--r); text-decoration: none; color: inherit; }
.mini:hover { background: var(--orange-soft); }
.badge.old { background: #fef3c7; color: #92400e; }
.badge.paid { background: #dcfce7; color: var(--green); }
.badge.part { background: #fef3c7; color: #92400e; }
.badge.open { background: #fee2e2; color: var(--red); }
.pay { display: grid; grid-template-columns: 1fr 1fr 1fr 1.1fr; gap: 10px; align-items: end; margin-top: 10px; padding: 10px; border-radius: var(--r); background: #f9fafb; }
.pay .row { grid-column: 1 / -1; }
.pay .restv { display: block; font-size: 18px; padding: 6px 0; }
.pay input { text-align: right; }
[hidden] { display: none !important; }
@media (max-width: 1500px) { .ov { grid-template-columns: 1fr 1fr; } .ov aside { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; align-items: start; } .ov aside .card { margin: 0; } }
@media (max-width: 1000px) { .ov, .split { grid-template-columns: 1fr; } .split > div:first-child { position: static; } .vgrid { grid-template-columns: 1fr; } }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }

/* Formularelemente */
input, textarea, select { font: inherit; color: inherit; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: var(--r); background: #fff; width: 100%; }
textarea { resize: vertical; min-height: 40px; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--orange); outline-offset: 1px; border-color: var(--orange); }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
.btn { font: inherit; font-weight: 600; padding: 8px 14px; border-radius: var(--r); border: 1px solid transparent; background: var(--orange); color: #fff; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--orange-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #d1d5db; }
.btn.ghost:hover { border-color: var(--orange); color: var(--orange); background: #fff; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.danger:hover { border-color: var(--red); color: var(--red); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 2px rgb(0 0 0 / .04); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 10px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: 1fr 1fr 1fr; }
.g4 { grid-template-columns: 1.2fr 1fr 1.2fr auto; align-items: end; }
.gart { grid-template-columns: 1fr 200px auto; align-items: end; }
td input.kitext { background: #fef3c7; border-color: #f59e0b; }
.cols { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }

/* Kacheln */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.tile.hot { border-color: var(--green); background: #f0fdf4; } .tile.hot strong { color: var(--green); }
.tile.warn { border-color: #f59e0b; background: #fffbeb; } .tile.warn strong { color: #92400e; }
.tile { display: block; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.tile:hover { border-color: var(--orange); }
.tile strong { display: block; font-size: 30px; line-height: 1.1; color: var(--orange); }

/* Schnellerfassung */
.quick { border-left: 4px solid var(--orange); }
.quick .check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; margin: 0; }
.quick .check input { width: auto; }

/* Vorgang */
.v .nr { font-weight: 800; font-size: 17px; }
.badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #eef2f7; color: var(--muted); }
.badge.R { background: #fee2e2; color: var(--red); }
.badge.B { background: #dbeafe; color: #1d4ed8; }
.badge.S { background: #fef3c7; color: #92400e; }
.v .fields { margin: 10px 0; }
.v .fields input, .v textarea.txt { border-color: transparent; background: #f9fafb; }
.v .fields input:hover, .v textarea.txt:hover { border-color: #d1d5db; }
.v.done { opacity: .65; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { font: inherit; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 20px; border: 1px solid #d1d5db; background: #fff; color: var(--muted); cursor: pointer; }
.chip:hover { border-color: var(--orange); color: var(--orange); }
.chip.on { background: var(--orange); border-color: var(--orange); color: #fff; }
.chip.on.fin { background: var(--green); border-color: var(--green); }
.notes { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.note { display: flex; gap: 8px; font-size: 13px; padding: 2px 0; }
.note time { color: var(--muted); white-space: nowrap; }
.note button, .x { border: 0; background: none; color: #9ca3af; cursor: pointer; font-size: 15px; padding: 0 4px; }
.note button:hover, .x:hover { color: var(--red); }
.notes input { margin-top: 4px; font-size: 13px; padding: 6px 10px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 6px; }
td { padding: 3px 6px; vertical-align: middle; }
td input { border-color: transparent; background: #f9fafb; }
td input:hover { border-color: #d1d5db; }
.num { text-align: right; }
td.num input { text-align: right; }
.w-s { width: 80px; } .w-m { width: 120px; } .w-x { width: 34px; } .w-c { width: 30px; }
td input[type=checkbox], th input[type=checkbox] { width: auto; }
tr.est td input[data-pf=einzelpreis] { background: #fef3c7; border-color: #f59e0b; }
.totals { margin: 12px 0 0 auto; width: 300px; }
.totals div { display: flex; justify-content: space-between; padding: 2px 0; color: var(--muted); }
.totals .sum { font-size: 19px; font-weight: 800; color: var(--ink); border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 6px; }

/* Angebotsliste */
.alist a { display: block; padding: 10px 12px; border-radius: var(--r); text-decoration: none; color: inherit; border: 1px solid transparent; }
.alist a:hover { background: var(--orange-soft); }
.alist a.on { border-color: var(--orange); background: var(--orange-soft); }
.ki { background: linear-gradient(135deg, #fff, var(--orange-soft)); border-color: #f6c79c; }

/* Layoutvorlagen */
.lpick { display: flex; gap: 8px; flex-wrap: wrap; }
.lpick button { font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); width: 92px; padding: 8px 4px 6px; border: 2px solid var(--line); border-radius: var(--r); background: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lpick button:hover { border-color: #f6c79c; }
.lpick button.on { border-color: var(--orange); color: var(--orange); background: var(--orange-soft); }
.lpick svg { width: 40px; height: 52px; fill: none; stroke: #9ca3af; stroke-width: 1.6; stroke-linecap: round; }
.lpick svg .p { fill: #fff; stroke: #cbd5e1; }
.lpick svg .f { fill: #e5e7eb; stroke: none; }
.lpick svg .o { fill: var(--orange); stroke: none; }
.flybox { margin-top: 12px; padding: 12px; border-radius: var(--r); background: var(--orange-soft); border: 1px solid #f6c79c; }
.bildbox { margin-top: 12px; padding: 12px; border: 2px dashed #d1d5db; border-radius: var(--r); background: #fafafa; }
.bild { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bild img { height: 96px; max-width: 170px; object-fit: contain; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.bild.haupt img { border: 2px solid var(--orange); }
.bild figcaption { display: flex; align-items: center; gap: 2px; }
.bildplus { display: grid; place-items: center; width: 96px; height: 96px; margin: 0; border: 2px dashed #d1d5db; border-radius: var(--r); color: var(--muted); font-size: 14px; cursor: pointer; background: #fff; }
.bildplus:hover { border-color: var(--orange); color: var(--orange); }
.thumb { height: 84px; max-width: 160px; object-fit: contain; border-radius: 6px; border: 1px solid var(--line); background: #fff; }

/* Druckvorschau */
#pvdlg { width: min(980px, 96vw); }
.pvopts { margin: 14px 0; gap: 14px; align-items: flex-end; }
.pvopts #pvinfo { padding-bottom: 10px; }
.pvmail { margin: 0 0 14px; padding: 10px 12px; gap: 12px; align-items: flex-end; border-radius: var(--r); background: var(--orange-soft); border: 1px solid #f6c79c; }
.pvmail #pvmailinfo { padding-bottom: 10px; }
.err { color: var(--red); font-weight: 600; }
.pv { background: #d1d5db; border-radius: var(--r); padding: 20px; max-height: 66vh; overflow: auto; display: flex; justify-content: center; align-items: flex-start; }
.pvlabels { display: flex; flex-direction: column; gap: 3mm; }
.pv .lbl, .pvsheet { background: #fff; color: #000; box-shadow: 0 1px 5px rgb(0 0 0 / .35); flex: none; }

/* Dialog + Toast */
dialog { border: 0; border-radius: 12px; padding: 22px; width: min(560px, 92vw); box-shadow: 0 20px 50px rgb(0 0 0 / .25); }
dialog::backdrop { background: rgb(17 24 39 / .45); }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--r); opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 80vw; z-index: 20; }
#toast.show { opacity: 1; }
#toast.err { background: var(--red); }

@media (max-width: 1100px) { .cols { grid-template-columns: 1fr !important; } }
@media (max-width: 860px) {
  .top { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  #suche { width: 100%; order: 5; }
  main { padding: 14px; }
  .cols, .g3, .g4 { grid-template-columns: 1fr; }
}

/* ---------- Druck ---------- */
#print { display: none; }
@media print {
  html, body { background: #fff; }
  body > *:not(#print) { display: none !important; }
  #print { display: block; color: #000; }
}
/* Etiketten: ein Etikett je Seite */
.lbl { width: var(--lw); height: var(--lh); padding: 1.5mm 2mm; overflow: hidden; page-break-after: always; break-after: page; display: flex; flex-direction: column; font-family: Arial, sans-serif; line-height: 1.15; }
.lbl:last-child { page-break-after: auto; break-after: auto; }
.lbl .l1 { display: flex; justify-content: space-between; align-items: baseline; border-bottom: .4mm solid #000; padding-bottom: .5mm; margin-bottom: .8mm; }
.lbl { font-size: calc(10pt * var(--s, 1)); } /* --s skaliert die Schrift mit der Etikettengröße */
.lbl .l1 b { font-size: 1.3em; }
.lbl .l1 span { font-size: .7em; }
.lbl .k { font-size: 1em; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lbl .t { font-size: .8em; overflow: hidden; }
.lbl .f { margin-top: auto; font-size: .65em; display: flex; justify-content: space-between; }
.lbl.price { justify-content: center; text-align: center; }
.lbl.price .n { font-size: 1em; font-weight: 700; overflow: hidden; max-height: 2.4em; }
.lbl.price .p { font-size: 2.2em; font-weight: 800; line-height: 1.05; }
.lbl.price .m { font-size: .6em; }
/* Preisetiketten auf A4-Bogen */
.sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.sheet .cell { border: .2mm dashed #999; padding: 3mm; overflow: hidden; display: flex; flex-direction: column; justify-content: center; text-align: center; break-inside: avoid; font-family: Arial, sans-serif; font-size: calc(10pt * var(--s, 1)); }
.sheet .n { font-size: 1.1em; font-weight: 700; }
.sheet .p { font-size: 2.6em; font-weight: 800; color: #000; }
.sheet .m { font-size: .7em; }
/* Flyer-Vorlagen (A4, Rand 12 mm → 273 mm nutzbare Höhe) */
.fly { height: 271mm; display: flex; flex-direction: column; overflow: hidden; font-family: Arial, sans-serif; color: #111; text-align: center; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.fly .fh { display: flex; justify-content: space-between; align-items: center; text-align: right; font-size: 11pt; font-weight: 700; border-bottom: 1.2mm solid #e16400; padding-bottom: 4mm; }
.fly .fh img { height: 18mm; }
.fly .fmid { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5mm; padding: 6mm 0; }
.fly h1 { font-size: 34pt; line-height: 1.1; margin: 0; font-weight: 800; }
.fly .slog { font-size: 15pt; color: #444; }
.fly .fimg { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.fly .fimg img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 3mm; }
.fly .fmore { display: flex; gap: 4mm; justify-content: center; flex: none; height: 32mm; }
.fly .fmore img { height: 100%; max-width: 45mm; object-fit: contain; border-radius: 2mm; border: .2mm solid #ddd; }
.fly-flyer .fbody { flex-wrap: wrap; align-content: center; }
.fly-flyer .fmore { flex-basis: 100%; }
.doc .dbilder { display: flex; flex-wrap: wrap; gap: 4mm; margin: 5mm 0 2mm; }
.doc .dbilder img { height: 42mm; max-width: 80mm; object-fit: contain; border: .2mm solid #ddd; border-radius: 1.5mm; }
.fly .fprice { background: #e16400; color: #fff; border-radius: 6mm; padding: 4mm 12mm 5mm; display: inline-flex; flex-direction: column; line-height: 1.05; }
.fly .fprice b { font-size: 54pt; font-weight: 800; white-space: nowrap; line-height: 1.2; }
.fly .fprice small { font-size: 11pt; font-weight: 700; }
.fly .ffor { font-size: 10pt; color: #444; margin-bottom: 2mm; }
.fly .ffoot { border-top: .4mm solid #e16400; padding-top: 3mm; font-size: 9pt; color: #444; line-height: 1.5; }
/* Flyer: Foto links, Vorteile rechts */
.fly-flyer .fbody { flex: 1; min-height: 0; width: 100%; display: flex; gap: 8mm; align-items: center; }
.fly-flyer .fimg { flex: 0 0 45%; width: auto; height: 100%; }
.fly-flyer .ftxt { flex: 1; min-width: 0; text-align: left; }
.fly-flyer ul { margin: 0; padding: 0; list-style: none; font-size: 15pt; line-height: 1.35; }
.fly-flyer li { padding: 1.5mm 0 1.5mm 9mm; position: relative; }
.fly-flyer li::before { content: "✓"; position: absolute; left: 0; color: #e16400; font-weight: 800; }
.fly-flyer .fpos { margin-top: 5mm; font-size: 10.5pt; }
.fly-flyer .fpos td { border-bottom: .2mm solid #ccc; padding: 1.5mm 0; }
/* Aufsteller-Karte: Stichpunkte mittig als Block, groß */
.fly-karte .fmid { gap: 8mm; }
.fly-karte h1 { font-size: 38pt; }
.fly-karte ul { display: inline-block; text-align: left; font-size: 24pt; }
.fly-karte .fprice b { font-size: 72pt; }
.fly-karte .fprice small { font-size: 14pt; }
/* Foto + Preis: alles noch größer */
.fly-foto h1 { font-size: 40pt; }
.fly-foto .fprice b { font-size: 84pt; }
.fly-foto .fprice small { font-size: 14pt; }
/* Aktions-Raster */
.fly-raster .fimg { max-height: 60mm; }
.fly-raster .fgrid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 5mm; }
.fly-raster .ftile { border: .5mm solid #e16400; border-radius: 4mm; padding: 5mm 4mm; display: flex; flex-direction: column; justify-content: center; gap: 2mm; }
.fly-raster .ftile .n { font-size: 13pt; font-weight: 700; }
.fly-raster .ftile .p { font-size: 28pt; font-weight: 800; color: #e16400; }

/* A4-Dokumente */
.doc { font-family: Arial, sans-serif; font-size: 10.5pt; line-height: 1.4; }
.doc .dh { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: .6mm solid #e16400; padding-bottom: 4mm; margin-bottom: 10mm; }
.doc .dlogo { height: 15mm; width: auto; }
.doc .abs { font-size: 7pt; color: #555; text-decoration: underline; margin-bottom: 2mm; }
.doc .adr2 { display: flex; justify-content: space-between; align-items: flex-start; gap: 10mm; }
.doc table.info { width: auto; margin: 0; font-size: 9.5pt; }
.doc table.info td { border: 0; padding: .6mm 0 .6mm 5mm; }
.doc table.info td:first-child { color: #555; padding-left: 0; }
.doc .sign { display: flex; gap: 12mm; margin-top: 18mm; break-inside: avoid; }
.doc .sign div { flex: 1; border-top: .3mm solid #000; padding-top: 1mm; font-size: 8pt; color: #444; }
.doc .dfoot { margin-top: 10mm; padding-top: 2mm; border-top: .3mm solid #e16400; font-size: 7.5pt; color: #555; text-align: center; }
.doc .firma { text-align: right; font-size: 9pt; }
.doc .addr { min-height: 30mm; white-space: pre-line; }
.doc h1 { font-size: 16pt; margin: 6mm 0 1mm; }
.doc .meta { color: #444; margin-bottom: 6mm; }
.doc table { margin-top: 5mm; }
.doc th { border-bottom: .4mm solid #000; font-size: 9pt; color: #000; padding: 2mm; }
.doc td { border-bottom: .2mm solid #ccc; padding: 2mm; }
.doc tr { break-inside: avoid; }
.doc .totals { width: 80mm; margin-top: 5mm; }
.doc .totals div { color: #000; }
.doc .foot { margin-top: 12mm; font-size: 9pt; color: #444; }
.doc .cat td { font-weight: 700; background: #f3f4f6; border-bottom: .4mm solid #000; }
