:root {
  --bg: #f4f6f8; --card: #ffffff; --ink: #1c2733; --muted: #64748b;
  --accent: #0b5fff; --danger: #d92d20; --ok: #12805c; --border: #e2e8f0;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
       background: var(--bg); color: var(--ink); }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.ok { color: var(--ok); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: min(380px, 92vw); display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 0; font-size: 1.3rem; letter-spacing: .08em; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px;
        padding: 20px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .85rem; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid var(--border);
        border-radius: 8px; }
.btn { font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 8px;
       border: 1px solid var(--border); background: #fff; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { padding: 6px 10px; font-size: .85rem; }
a.btn { display: inline-block; text-decoration: none; }
.btn.danger { color: var(--danger); }

.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 20px;
          background: var(--card); border-bottom: 1px solid var(--border); }
.topbar strong { letter-spacing: .06em; }
.topbar span { flex: 1; }

.layout { display: flex; min-height: calc(100vh - 53px); }
.sidenav { width: 210px; padding: 16px 10px; display: flex; flex-direction: column; gap: 4px; }
.sidenav a { padding: 10px 14px; border-radius: 8px; color: var(--ink);
             text-decoration: none; font-weight: 600; }
.sidenav a.active, .sidenav a:hover { background: #e3ecff; color: var(--accent); }
.content { flex: 1; padding: 24px; max-width: 1200px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
             gap: 14px; margin-bottom: 20px; }
.stat { text-align: center; }
.stat .num { font-size: 2rem; font-weight: 800; }

table { width: 100%; border-collapse: collapse; background: var(--card);
        border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border);
         vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem;
         font-weight: 700; background: #eef2f7; }
.badge.ok { background: #d9f2e5; color: var(--ok); }
.badge.warn { background: #fff2d9; color: #92400e; }
.badge.err { background: #fde2df; color: var(--danger); }

.toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
             gap: 12px; }
h2 { margin-top: 0; }

/* Freigabe: Kacheln und Bildpaare */
.freigabe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
                 gap: 14px; }
.kachel { display: flex; flex-direction: column; gap: 10px; padding: 12px; color: inherit;
          text-decoration: none; transition: box-shadow .15s, transform .15s; }
.kachel:hover { box-shadow: 0 6px 20px rgba(28, 39, 51, .12); transform: translateY(-2px); }
.kachel-bild { aspect-ratio: 4 / 3; background: #eef2f7; border-radius: 8px; overflow: hidden;
               display: flex; align-items: center; justify-content: center; }
.kachel-bild img { width: 100%; height: 100%; object-fit: contain; }
.kachel-text { display: flex; flex-direction: column; gap: 2px; font-size: .9rem; }

.freigabe-kopf { display: flex; justify-content: space-between; align-items: start; gap: 16px;
                 flex-wrap: wrap; margin-bottom: 16px; }
.freigabe-kopf h2 { margin-bottom: 4px; }
.pruefliste { margin-bottom: 20px; }
.pruefliste p { margin: 8px 0 0; }
.pruefliste ul { margin: 4px 0 0; padding-left: 20px; }

.bildpaar { margin-bottom: 14px; padding: 14px; }
.bildpaar header { margin-bottom: 10px; }
.bildpaar-spalten { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
                    gap: 14px; }
.bild-figur { position: relative; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.bild-figur img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #eef2f7;
                  border-radius: 8px; border: 1px solid var(--border); }
.bild-figur figcaption { display: flex; justify-content: space-between; font-size: .85rem;
                         font-weight: 600; }
.bild-leer { min-height: 180px; align-items: center; justify-content: center;
             border: 1px dashed var(--border); border-radius: 8px; }
.bild-aktionen { display: flex; gap: 6px; flex-wrap: wrap; }
.hauptbild-marke { position: absolute; top: 8px; left: 8px; z-index: 1; padding: 2px 10px;
                   border-radius: 999px; background: var(--accent); color: #fff;
                   font-size: .75rem; font-weight: 700; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidenav { width: 100%; flex-direction: row; overflow-x: auto; }
  .content { padding: 14px; }
}

/* Artikel bearbeiten */
.artikel-form { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.artikel-form h3, .card h3 { margin: 0 0 12px; }
.form-grid .breit, .artikel-form label.breit { grid-column: 1 / -1; }
label > span:first-child { display: flex; gap: 6px; align-items: center; }
.quelle { font-size: .7rem; font-weight: 700; padding: 0 6px; border-radius: 999px;
          background: #e3ecff; color: var(--accent); }
textarea { resize: vertical; }
.merkmale { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.merkmal-zeile { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
                 gap: 8px; width: 100%; }
.merkmal-zeile input, .form-grid input, .form-grid select, .form-grid textarea { min-width: 0; width: 100%; }
@media (max-width: 760px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 14px; }
}
.speicherleiste { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px 0 0; }
/* Nur beim langen Artikelformular bleibt „Speichern“ unten im Blick. */
.artikel-form > .speicherleiste { position: sticky; bottom: 0; z-index: 2; padding: 12px 0;
                                  background: var(--bg); }
.fragen { margin-bottom: 14px; border-color: #f5c46a; background: #fffaf0; }
.frage { padding: 10px 0; border-top: 1px solid var(--border); }
.frage:first-of-type { border-top: none; }
.frage p { margin: 0 0 8px; }
.kandidaten { display: flex; gap: 8px; flex-wrap: wrap; }
.marktpreis { margin: 12px 0 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card + .card, section.card { margin-bottom: 14px; }

/* KI-Kosten: Anteile je Zweck als schlichte Balken */
td.zahl, th.zahl { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ki-anteile { width: 100%; }
.ki-anteile td { padding: 6px 8px; }
.ki-balken { width: 45%; }
.ki-balken span { display: block; height: 10px; border-radius: 4px; background: #2a78d6; min-width: 2px; }
@media (max-width: 640px) { .ki-balken, .ki-laeufe { display: none; } }

/* „Angemeldet bleiben“ auf der Anmeldeseite */
.login-card label.merken { display: flex; flex-direction: row; align-items: center; gap: 8px;
  font-weight: 500; cursor: pointer; }
.login-card label.merken input { width: auto; margin: 0; }

/* Offene Aufgaben */
.aufgaben-liste { margin: 0; padding-left: 1.1em; }
.aufgaben-liste li { margin: 2px 0; }
#nav a .badge { margin-left: 4px; font-size: 11px; padding: 0 6px; vertical-align: 1px; }
#nav a[href="#aufgaben"] { white-space: nowrap; }

/* Bestand korrigieren und Artikel löschen */
form.korrektur { background: #f6f8fb; border: 1px solid var(--border, #e2e5ea); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card.gefahr { border-color: #f1c4c4; }
.card.gefahr h3 { color: var(--danger); }

/* Vertriebskanäle und Kleinanzeigen-Assistent */
.kanal-liste { list-style: none; margin: 10px 0 14px; padding: 0; display: grid; gap: 8px; }
.kanal-liste li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.kanal-liste label { display: inline-flex; flex-direction: row; align-items: center; gap: 8px;
                     cursor: pointer; font-size: 1rem; font-weight: 400; }
.kanal-liste label .muted { font-size: .85rem; }
.kanal-liste input[type=checkbox] { width: 18px; height: 18px; padding: 0; margin: 0; }
#kleinanzeigen-assistent .toolbar #ka-url { flex: 1 1 320px; min-width: 0; }
.ka-schritte { margin: 10px 0; padding-left: 1.3em; }
.ka-schritte li { margin: 6px 0; }
.ka-felder { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: end; margin: 14px 0; }
.ka-felder label { display: grid; gap: 4px; }
.ka-felder input, .ka-felder textarea { width: 100%; }
.ka-bilder { display: flex; flex-wrap: wrap; gap: 10px; }
.ka-bilder a { display: grid; gap: 4px; width: 110px; font-size: .85rem; text-decoration: none; }
.ka-bilder img { width: 110px; height: 110px; object-fit: contain; background: #f3f4f3; border-radius: 6px; }
@media (max-width: 640px) { .ka-felder { grid-template-columns: 1fr; } }

/* Preise je Kanal */
.kanal-preis { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: 8px; }
.preis-feld { width: 7em; padding: 4px 8px; }
td.preis-regel { white-space: nowrap; }
td.preis-regel label, label.haken { display: inline-flex; flex-direction: row; align-items: center; gap: 4px; }
td.preis-regel .preis-feld { width: 4.5em; }
label.haken input { width: auto; }
.form-grid label.haken { align-self: end; padding-bottom: 12px; }
.knopf-spalte { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 150px; }
.muted.klein { font-size: 0.85em; }
