/* Gemeinsame Gestaltung: hell und ruhig, Warnungen in Gelb, Fehler in Rot. */

:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --flaeche: #ffffff;
  --flaeche-leise: #faf9f6;
  --text: #1f2430;
  --text-leise: #5a6170;
  --rand: #d8d8d2;
  --rand-stark: #b9bbb4;
  --akzent: #2d5b87;
  --akzent-dunkel: #21486d;
  --akzent-hell: #e6eef6;
  --ok: #1d7044;
  --ok-bg: #e4f3ea;
  --ok-rand: #9fd2b6;
  --gelb: #7a5600;
  --gelb-bg: #fff5d1;
  --gelb-rand: #e6c658;
  --rot: #9f2323;
  --rot-bg: #fbe9e9;
  --rot-rand: #e1a6a6;
  --radius: 6px;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

/* Das hidden-Attribut gewinnt immer, auch gegen display-Angaben der Klassen. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--schrift);
}

/* Platzieransicht und Verwaltung brauchen Platz für zwei Bilder nebeneinander. */
body.breit {
  min-width: 1100px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  font-weight: 600;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

a {
  color: var(--akzent);
}

a:hover {
  color: var(--akzent-dunkel);
}

/* ---------- Kopf und Inhalt ---------- */

.kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--flaeche);
  border-bottom: 1px solid var(--rand);
}

.kopf nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.inhalt {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 48px;
  display: grid;
  gap: 20px;
}

.bereich {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  display: grid;
  gap: 14px;
}

.leise {
  color: var(--text-leise);
}

.klein {
  font-size: 13px;
}

/* ---------- Formularfelder und Knöpfe ---------- */

label.feld {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-leise);
}

input[type="text"],
input[type="password"],
input[type="search"] {
  font: inherit;
  color: var(--text);
  padding: 7px 9px;
  border: 1px solid var(--rand-stark);
  border-radius: var(--radius);
  background: #fff;
  min-width: 0;
}

input[type="file"] {
  font: inherit;
  font-size: 14px;
  color: var(--text);
}

input[type="file"]::file-selector-button {
  font: inherit;
  margin-right: 10px;
  padding: 7px 12px;
  border: 1px solid var(--akzent);
  border-radius: var(--radius);
  background: var(--akzent-hell);
  color: var(--akzent-dunkel);
  cursor: pointer;
}

input:focus-visible,
button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 2px;
}

.knopf {
  font: inherit;
  padding: 7px 14px;
  border: 1px solid var(--rand-stark);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.knopf:hover:not(:disabled) {
  background: var(--flaeche-leise);
  border-color: var(--text-leise);
}

.knopf:disabled {
  opacity: 0.55;
  cursor: default;
}

.knopf.haupt {
  background: var(--akzent);
  border-color: var(--akzent);
  color: #fff;
}

.knopf.haupt:hover:not(:disabled) {
  background: var(--akzent-dunkel);
  border-color: var(--akzent-dunkel);
}

.knopf.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--akzent);
  text-decoration: underline;
}

.knopf.link:hover:not(:disabled) {
  background: none;
  color: var(--akzent-dunkel);
}

/* Löschen: rot, damit er sich von „Vorbereiten“ abhebt */
.knopf.gefahr {
  color: var(--rot);
  border-color: var(--rot-rand);
}

.knopf.gefahr:hover:not(:disabled) {
  background: var(--rot-bg);
  border-color: var(--rot);
}

.knopf.klein {
  padding: 3px 10px;
  font-size: 13px;
}

/* ---------- Meldungen und Marken ---------- */

.meldung {
  margin: 0;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.meldung.fehler {
  background: var(--rot-bg);
  border-color: var(--rot-rand);
  color: var(--rot);
}

.meldung.warn {
  background: var(--gelb-bg);
  border-color: var(--gelb-rand);
  color: var(--gelb);
}

.meldung.ok {
  background: var(--ok-bg);
  border-color: var(--ok-rand);
  color: var(--ok);
}

.marke {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--rand-stark);
  background: var(--flaeche-leise);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.marke.ok {
  background: var(--ok-bg);
  border-color: var(--ok-rand);
  color: var(--ok);
}

.marke.warn {
  background: var(--gelb-bg);
  border-color: var(--gelb-rand);
  color: var(--gelb);
}

.marke.fehler {
  background: var(--rot-bg);
  border-color: var(--rot-rand);
  color: var(--rot);
}

/* ---------- Anmeldung ---------- */

.anmeldung-seite {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.anmeldung {
  width: 100%;
  max-width: 340px;
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 24px;
  display: grid;
  gap: 14px;
}

.anmeldung form {
  display: grid;
  gap: 14px;
}

/* ---------- Verwaltung: Bibliothek ---------- */

.upload-zeile {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 24px;
}

.upload-feld {
  display: grid;
  gap: 4px;
}

.upload-feld > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-leise);
}

.fortschritt {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fortschritt progress {
  width: 320px;
  height: 14px;
}

.bericht {
  display: grid;
  gap: 10px;
}

.bericht-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.bericht-liste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.bericht-artikel {
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  background: var(--flaeche-leise);
  padding: 10px 12px;
  display: grid;
  gap: 6px;
}

.bericht-titel {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.bericht-titel .artnr {
  font-weight: 700;
}

.bericht-artikel ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  font-size: 14px;
}

.bericht-artikel li.warn {
  color: var(--gelb);
  background: var(--gelb-bg);
  border-left: 3px solid var(--gelb-rand);
  padding: 2px 8px;
}

.bericht-artikel li.rot {
  color: var(--rot);
  background: var(--rot-bg);
  border-left: 3px solid var(--rot-rand);
  padding: 2px 8px;
}

.bericht-artikel li.ohne-code {
  color: var(--gelb);
}

details.ignoriert {
  font-size: 14px;
  color: var(--text-leise);
}

details.ignoriert summary {
  cursor: pointer;
}

details.ignoriert ul {
  margin: 6px 0 0;
  padding-left: 20px;
  max-height: 220px;
  overflow: auto;
}

/* ---------- Verwaltung: Artikelliste ---------- */

.listenkopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tabelle-rahmen {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
}

table.artikel {
  width: 100%;
  border-collapse: collapse;
}

table.artikel th,
table.artikel td {
  text-align: left;
  padding: 7px 12px;
  border-bottom: 1px solid var(--rand);
}

table.artikel thead th {
  position: sticky;
  top: 0;
  background: var(--flaeche-leise);
  font-size: 13px;
  color: var(--text-leise);
  z-index: 1;
}

table.artikel tbody tr:last-child td {
  border-bottom: 0;
}

table.artikel tbody tr:hover {
  background: var(--akzent-hell);
}

table.artikel tr.gewaehlt {
  background: var(--akzent-hell);
}

table.artikel td.aktion {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

/* ---------- Verwaltung: Foto vorbereiten ---------- */

.fotoliste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.fotoliste li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  background: var(--flaeche-leise);
}

.fotoliste li.gewaehlt {
  border-color: var(--akzent);
  background: var(--akzent-hell);
}

.fotoliste .dateiname {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.fotoliste .status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.fotoliste img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border: 1px solid var(--rand);
  border-radius: 4px;
  background: #fff;
}

.editor {
  display: grid;
  gap: 14px;
  padding-top: 6px;
  border-top: 1px solid var(--rand);
}

.editor-felder {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
}

.editor-felder input[name="farbcode"] {
  width: 90px;
  text-transform: uppercase;
}

.editor-felder input[name="farbname"] {
  width: 240px;
}

.editor-felder .aktionen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.bilder {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 640px));
  gap: 20px;
  justify-content: start;
}

.bilder figure {
  margin: 0;
  display: grid;
  gap: 6px;
  align-content: start;
}

.bilder figcaption {
  font-weight: 600;
}

.bilder figcaption .leise {
  font-weight: 400;
}

.bildrahmen {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--rand-stark);
  background: #fff;
  overflow: hidden;
  user-select: none;
}

.bildrahmen canvas,
.bildrahmen > img {
  display: block;
  width: 100%;
  height: 100%;
}

#vorher {
  cursor: crosshair;
  touch-action: none;
}

.bildplatz {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-leise);
  background: var(--flaeche-leise);
}

/* Hilfslinien über dem Nachher-Bild: die Linie selbst ist 2 px stark, die Greiffläche 14 px. */

.linie {
  position: absolute;
  --farbe: #333;
  touch-action: none;
}

.linie::before {
  content: "";
  position: absolute;
  background: var(--farbe);
}

.linie.waagrecht {
  left: 0;
  right: 0;
  height: 14px;
  margin-top: -7px;
  cursor: ns-resize;
}

.linie.waagrecht::before {
  left: 0;
  right: 0;
  top: 6px;
  height: 2px;
}

.linie.senkrecht {
  top: 0;
  bottom: 0;
  width: 14px;
  margin-left: -7px;
  cursor: ew-resize;
}

.linie.senkrecht::before {
  top: 0;
  bottom: 0;
  left: 6px;
  width: 2px;
}

.linie .etikett {
  position: absolute;
  padding: 0 6px;
  border-radius: 3px;
  background: var(--farbe);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  white-space: nowrap;
  pointer-events: none;
}

.linie.waagrecht .etikett {
  top: -9px;
}

.linie.waagrecht .etikett.links {
  left: 4px;
}

.linie.waagrecht .etikett.rechts {
  right: 4px;
}

.linie.senkrecht .etikett {
  left: 11px;
  top: 4px;
}

.linie.senkrecht .etikett.unten {
  top: auto;
  bottom: 4px;
}

.linie.senkrecht .etikett.links-von-linie {
  left: auto;
  right: 11px;
}

.linie:focus-visible {
  outline: none;
}

.linie:focus-visible::before {
  box-shadow: 0 0 0 3px rgba(45, 91, 135, 0.35);
}

.rechteckliste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rechteckliste li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px 3px 10px;
  border: 1px solid var(--rot-rand);
  border-radius: 999px;
  background: var(--rot-bg);
  color: var(--rot);
  font-size: 13px;
}

.rechteckliste button {
  font: inherit;
  line-height: 1;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--rot);
  cursor: pointer;
}

.rechteckliste button:hover {
  background: var(--rot);
  color: #fff;
}

/* ---------- kleine Hilfsklassen ---------- */

p.hilfe {
  margin: 0;
}

.feld.suche {
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
}

.feld.suche input {
  width: 260px;
}

/* ---------- Hauptmaske: Artikel und Logo, Auswahl ---------- */

.oberes-raster {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* Solange es nichts auszuwählen gibt, nimmt „Artikel und Logo“ die ganze Breite. */
.oberes-raster:has(#bereich-auswahl[hidden]) {
  grid-template-columns: minmax(0, 1fr);
}

.artikel-raster {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px 28px;
  align-items: start;
}

.artikel-spalte {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.sku-zeile {
  display: flex;
  align-items: end;
  gap: 10px;
}

.sku-zeile label {
  flex: 1;
}

.artikel-info {
  margin: 0;
  font-weight: 600;
}

.kacheln {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.kachel {
  font: inherit;
  display: grid;
  gap: 4px;
  justify-items: center;
  width: 108px;
  padding: 6px;
  border: 2px solid var(--rand);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.kachel:hover {
  border-color: var(--rand-stark);
}

.kachel.gewaehlt {
  border-color: var(--akzent);
  background: var(--akzent-hell);
}

.kachel img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  background: #fff;
}

.kachel-name {
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.logo-block {
  display: grid;
  gap: 8px;
}

.logo-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
}

.farbfeld {
  display: inline-block;
  width: 22px;
  height: 22px;
  margin-left: -10px;
  border: 1px solid var(--rand-stark);
  border-radius: 4px;
  vertical-align: middle;
}

.haken {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

fieldset.wahl {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  min-width: 0;
}

fieldset.wahl legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-leise);
}

.wahl-reihe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
}

.wahl-eintrag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

input[type="color"] {
  width: 40px;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--rand-stark);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
}

/* ---------- Hauptmaske: Platzieren ---------- */

.bereichskopf {
  display: flex;
  align-items: center;
  gap: 14px;
}

.platzier-raster {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 24px;
  align-items: start;
}

.platzierbereich {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  border-radius: var(--radius);
}

.platzier-seite {
  display: grid;
  gap: 16px;
  align-content: start;
}

.vorschau-figur {
  margin: 0;
  display: grid;
  gap: 6px;
  align-content: start;
}

.vorschau-figur figcaption {
  font-weight: 600;
}

.vorschau-rahmen {
  position: relative;
  border: 1px solid var(--rand-stark);
  background: #fff;
  overflow: hidden;
  line-height: 0;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.vorschau-rahmen.zieht {
  cursor: grabbing;
}

.vorschau-bild {
  display: block;
  width: 100%;
  height: auto;
}

/* Das Logo-PNG liegt nur zwischen zwei genauen Vorschauen über dem Bild; die gestrichelte Kante zeigt: das ist die neue Lage. */
.logo-overlay {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  pointer-events: none;
  outline: 1px dashed var(--akzent);
}

.vorschau-platz {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 16px;
  line-height: 1.45;
  color: var(--text-leise);
  background: var(--flaeche-leise);
  cursor: default;
}

.nb {
  white-space: nowrap;
}

.live-zeile {
  margin: 0;
  min-height: 2.9em; /* zwei Zeilen: nichts springt, wenn der Text umbricht */
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.regler-zeile {
  display: grid;
  gap: 16px;
}

.regler-block {
  display: grid;
  gap: 6px;
}

.regler-titel {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-leise);
}

.regler-block input[type="range"] {
  width: 100%;
}

#groesse-mm {
  font-variant-numeric: tabular-nums;
}

.knopfgruppe {
  display: flex;
  gap: 6px;
}

.hinweise {
  display: grid;
  gap: 8px;
}

input[type="radio"],
input[type="checkbox"],
input[type="range"] {
  accent-color: var(--akzent);
}

.hinweise:empty {
  display: none;
}

.fertig-block {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--rand);
}

.fertig-zeile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.knopf.gross {
  padding: 10px 32px;
  font-size: 17px;
  font-weight: 600;
}

a.knopf {
  display: inline-block;
  text-decoration: none;
}

.ergebnis {
  display: grid;
  gap: 8px;
}

.ergebnis:empty {
  display: none;
}

.dateiliste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.ergebnis-zip {
  margin: 0;
}

/* ---------- Hauptmaske: Letzte Aufträge ---------- */

table.auftraege td.nr {
  font-weight: 600;
  white-space: nowrap;
}

table.auftraege td.dateilinks {
  white-space: nowrap;
}

table.auftraege td.dateilinks a + a {
  margin-left: 12px;
}
