/* KDP-Weboberfläche – schlicht, mobile zuerst, hell/dunkel über prefers-color-scheme.

   Klassen für alle Seiten:
   .karte            Box mit Rahmen (.karte.schmal = zentrierte Formularkarte, .mitte = zentrierter Text)
   .raster           responsives Kartenraster (auto-fill, min. 16rem)
   .tabelle          Tabelle (in .tabelle-wrap für horizontales Scrollen am Handy)
   .knopf            Knopf/Link-Knopf; .knopf.primaer (Hauptaktion), .knopf.gefahr (löschen/zurücksetzen)
   .status-<status>  Status-Etikett: konzept, in_arbeit, freigabe_ausstehend, freigegeben, live
   .badge.ok|fehler|hinweis   kleine Marke (z. B. Preflight)
   .editor           Monospace-Textarea;  .log  Logausgabe (Monospace, scrollbar)
   .galerie          Bildraster (figure > img + figcaption)
   .tabs             Reiter-Navigation (a.aktiv)
   .flash.ok|fehler|hinweis   Meldungen
   .formular .feld   Formularzeilen (label.feld > input/select/textarea);  .zeile  Flex-Zeile;  .klein / .gedaempft
   .htmx-indicator   Ladeanzeige für htmx
*/
:root {
  --bg: #f6f7f9; --flaeche: #ffffff; --flaeche2: #eef0f4; --text: #1c2230; --text2: #5a6376;
  --rand: #d9dde5; --akzent: #2457c5; --akzent-text: #ffffff; --fokus: #2457c5;
  --ok: #1d7a46; --ok-bg: #e2f4ea; --fehler: #b3261e; --fehler-bg: #fbe6e4; --hinweis: #8a5a00; --hinweis-bg: #fdf1d6;
  --s-konzept: #5a6376; --s-konzept-bg: #e9ebf0;
  --s-in_arbeit: #1b5fa8; --s-in_arbeit-bg: #dceafa;
  --s-freigabe_ausstehend: #8a5a00; --s-freigabe_ausstehend-bg: #fdf1d6;
  --s-freigegeben: #1d7a46; --s-freigegeben-bg: #e2f4ea;
  --s-live: #5b2ea6; --s-live-bg: #ece3fa;
  --radius: .6rem; --schatten: 0 1px 2px rgba(20, 30, 50, .06);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c; --flaeche: #1a1e28; --flaeche2: #232836; --text: #e6e9f0; --text2: #a2abbd;
    --rand: #2f3547; --akzent: #6c97f0; --akzent-text: #0e1320; --fokus: #8fb0f7;
    --ok: #62d094; --ok-bg: #153325; --fehler: #ff8b83; --fehler-bg: #3b1b19; --hinweis: #f0c15c; --hinweis-bg: #382b0d;
    --s-konzept: #a2abbd; --s-konzept-bg: #272c3a;
    --s-in_arbeit: #7db4f5; --s-in_arbeit-bg: #152b47;
    --s-freigabe_ausstehend: #f0c15c; --s-freigabe_ausstehend-bg: #382b0d;
    --s-freigegeben: #62d094; --s-freigegeben-bg: #153325;
    --s-live: #c2a2f5; --s-live-bg: #2c1f47;
    --schatten: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); line-height: 1.55;
  font: 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
p { margin: 0 0 .9rem; }
a { color: var(--akzent); }
code, pre { font-family: var(--mono); font-size: .92em; }
code { background: var(--flaeche2); padding: .1em .35em; border-radius: .3rem; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; border-radius: .25rem; }
.klein { font-size: .875rem; }
.gedaempft { color: var(--text2); }
.mitte { text-align: center; }

/* Kopf und Navigation */
.kopf { background: var(--flaeche); border-bottom: 1px solid var(--rand); position: sticky; top: 0; z-index: 10; }
.kopf-innen { max-width: 70rem; margin: 0 auto; padding: .5rem 1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; }
.marke { font-weight: 700; letter-spacing: .04em; text-decoration: none; color: var(--text); padding: .4rem 0; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .25rem; flex: 1; }
.nav a, .nav-knopf {
  display: inline-block; padding: .45rem .7rem; border-radius: .45rem; color: var(--text2); text-decoration: none;
  font: inherit; background: none; border: 0; cursor: pointer; min-height: 2.5rem; line-height: 1.6;
}
.nav a:hover, .nav-knopf:hover { background: var(--flaeche2); color: var(--text); }
.nav a.aktiv { background: var(--flaeche2); color: var(--text); font-weight: 600; }
.nav-form { margin: 0 0 0 auto; }

.inhalt { max-width: 70rem; margin: 0 auto; padding: 1rem 1rem 3rem; }

/* Karten und Raster */
.karte { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); padding: 1rem; box-shadow: var(--schatten); margin-bottom: 1rem; }
.karte.schmal { max-width: 26rem; margin: 2rem auto; padding: 1.5rem; }
.karte > :last-child { margin-bottom: 0; }
.raster { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.raster > .karte { margin: 0; }
.fehlercode { font-size: 2.5rem; font-weight: 700; color: var(--text2); margin: 0; }
.zeile { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.schritte { padding-left: 1.2rem; color: var(--text2); }

/* Knöpfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.5rem;
  padding: .45rem 1rem; border-radius: .5rem; border: 1px solid var(--rand); background: var(--flaeche2);
  color: var(--text); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
}
.knopf:hover { border-color: var(--text2); }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf.primaer:hover { filter: brightness(1.08); }
.knopf.gefahr { background: transparent; border-color: var(--fehler); color: var(--fehler); }
.knopf.gefahr:hover { background: var(--fehler-bg); }
.knopf[disabled], .knopf.htmx-request { opacity: .55; cursor: progress; }

/* Formulare */
.formular { display: grid; gap: 1rem; }
.feld { display: grid; gap: .3rem; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .55rem .7rem; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--rand); border-radius: .5rem; min-height: 2.5rem;
}
input.code { font-family: var(--mono); font-size: 1.5rem; letter-spacing: .4em; text-align: center; }
.geheim { word-break: break-all; user-select: all; }
.qr { background: #fff; padding: .5rem; border-radius: .5rem; border: 1px solid var(--rand); }
.editor { font-family: var(--mono); font-size: .9rem; line-height: 1.45; min-height: 24rem; resize: vertical; white-space: pre; tab-size: 2; }
.log {
  font-family: var(--mono); font-size: .82rem; line-height: 1.4; background: #0f131a; color: #d7dde8;
  padding: .8rem; border-radius: var(--radius); max-height: 28rem; overflow: auto; white-space: pre-wrap; word-break: break-word;
}

/* Tabellen */
.tabelle-wrap { overflow-x: auto; }
.tabelle { width: 100%; border-collapse: collapse; background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); }
.tabelle th, .tabelle td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--rand); vertical-align: top; }
.tabelle th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text2); background: var(--flaeche2); }
.tabelle tr:last-child td { border-bottom: 0; }

/* Marken, Status, Meldungen */
.badge, [class*="status-"] {
  display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--flaeche2); color: var(--text2); white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.fehler { background: var(--fehler-bg); color: var(--fehler); }
.badge.hinweis { background: var(--hinweis-bg); color: var(--hinweis); }
.status-konzept { background: var(--s-konzept-bg); color: var(--s-konzept); }
.status-in_arbeit { background: var(--s-in_arbeit-bg); color: var(--s-in_arbeit); }
.status-freigabe_ausstehend { background: var(--s-freigabe_ausstehend-bg); color: var(--s-freigabe_ausstehend); }
.status-freigegeben { background: var(--s-freigegeben-bg); color: var(--s-freigegeben); }
.status-live { background: var(--s-live-bg); color: var(--s-live); }
.flash { padding: .7rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.flash.fehler { background: var(--fehler-bg); color: var(--fehler); border-color: var(--fehler); }
.flash.hinweis { background: var(--hinweis-bg); color: var(--hinweis); border-color: var(--hinweis); }

/* Reiter und Galerie */
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--rand); margin: 0 0 1rem; overflow-x: auto; }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--text2); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.aktiv { color: var(--text); font-weight: 600; border-bottom-color: var(--akzent); }
.galerie { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr)); margin: 0; padding: 0; list-style: none; }
.galerie figure { margin: 0; background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); overflow: hidden; }
.galerie img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--flaeche2); }
.galerie figcaption { padding: .4rem .6rem; font-size: .8rem; color: var(--text2); word-break: break-all; }

.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }

@media (min-width: 48rem) {
  .inhalt { padding: 1.5rem 1.5rem 4rem; }
  h1 { font-size: 1.75rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
