/* VintPilot — dunkles, ruhiges Interface. Eine Akzentfarbe, klare Flächen. */
:root {
  --bg: #0a0c10;
  --panel: #12151c;
  --panel2: #181c25;
  --border: #242a37;
  --text: #e9edf4;
  --muted: #8b94a7;
  --accent: #34d399;
  --accent-dim: #34d39922;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 14px;
  font-size: 16px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }

.splash { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 32px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
.logo .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--accent); display: inline-block; }
/* Markenzeichen (Fingerabdruck) — ersetzt den früheren Punkt */
.logo .mark { width: 26px; height: 26px; object-fit: contain; display: block; flex-shrink: 0; }
.auth-card .logo { justify-content: center; }
.auth-card .logo .mark { width: 34px; height: 34px; }
.auth-card h1 { font-size: 17px; font-weight: 600; margin: 22px 0 4px; }
.auth-card p.sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, select.input:focus, textarea.input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}
.input:hover:not(:focus), select.input:hover:not(:focus) { border-color: #38434f; }
.input::placeholder, textarea.input::placeholder { color: #5d6b7a; }
textarea.input { resize: vertical; min-height: 90px; }

/* Auswahlfelder: Betriebssystem-Aussehen abschalten und einen eigenen Pfeil
   zeichnen — sonst sieht das Feld auf jedem System anders (und altbacken) aus. */
select.input {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: 40px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b98a8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
select.input:focus {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235fe0a0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* Die aufgeklappte Liste selbst zeichnet das Betriebssystem — wenigstens die
   Farben mitgeben, damit sie im dunklen Umfeld nicht weiß aufblitzt. */
select.input option { background: var(--panel); color: var(--text); }

/* Dateiauswahl: der eingebaute Knopf ist auf jedem System anders und wirkt
   fremd. Hier wird er zu einem Knopf im Stil der Oberfläche. */
input[type="file"].input { padding: 9px 12px; cursor: pointer; }
input[type="file"].input::file-selector-button {
  font: inherit; font-weight: 600; font-size: 13.5px;
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 15px; margin-right: 12px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
input[type="file"].input::file-selector-button:hover {
  background: #222c36; border-color: var(--accent);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #04120c; border: none; border-radius: 10px;
  padding: 11px 18px; font-weight: 600;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--border); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.auth-switch { margin-top: 16px; font-size: 14px; color: var(--muted); text-align: center; }
.error-line { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- App-Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; border-right: 1px solid var(--border);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .logo { padding: 0 10px 18px; font-size: 19px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; color: var(--muted); font-size: 14.5px; font-weight: 500;
  background: none; border: none; width: 100%; text-align: left;
}
.nav-item:hover { color: var(--text); background: var(--panel); }
.nav-item.active { color: var(--text); background: var(--panel2); }
.nav-item .badge {
  margin-left: auto; background: var(--accent); color: #04120c;
  font-size: 12px; font-weight: 700; border-radius: 99px; padding: 1px 8px;
}
.nav-item .badge.warn { background: var(--warn); color: #2a1c00; }
.sidebar .foot { margin-top: auto; padding: 10px 12px; font-size: 12.5px; color: var(--muted); }

/* ---------- Privatmodus (für Screenshots und Videos) ---------- */
.privat-btn {
  display: block; width: 100%; margin-top: 8px; padding: 7px 9px;
  font-size: 12px; text-align: left; cursor: pointer;
  color: var(--muted); background: var(--panel2);
  border: 1px solid var(--border); border-radius: 8px;
}
.privat-btn:hover { color: var(--text); border-color: var(--accent); }
.privat-btn.an { color: var(--accent); border-color: var(--accent); font-weight: 600; }

/* Zusätzliches Netz: Ist der Modus an, werden Namensfelder auch dann
   unkenntlich, falls eine Stelle im Code übersehen wurde. BEWUSST ohne Aufdecken
   beim Überfahren mit der Maus: Beim Scrollen wandert der Inhalt unter dem
   Zeiger durch, dabei blitzten die Werte kurz auf — genau das, was in einer
   Aufnahme nicht passieren darf. Zum Nachsehen den Modus kurz ausschalten
   (Umschalt+P). */
body.privat .buyer, body.privat .log-acc, body.privat .tag.acc,
body.privat .auf-acc, body.privat .sync-z, body.privat .pill {
  filter: blur(4px);
}

/* Versandscheine enthalten Namen UND Anschriften. Sie werden als PDF gerendert,
   dort lässt sich kein Text ersetzen — deshalb wird die Vorschau verwischt. */
body.privat canvas.pdfthumb { filter: blur(7px); }

/* Für die Statistik gibt es hier BEWUSST keine Weichzeichner-Regel: In den
   scrollbaren Tabellen (.sttab hat overflow:auto) wird ein Weichzeichner an den
   Rändern abgeschnitten, und beim Überfahren mit der Maus blitzten die Beträge
   auf. Die Werte werden stattdessen in app.js durch „•••" ersetzt (Funktion
   `zahl()`) — was gar nicht erst im Text steht, kann auch nicht auftauchen. */

/* ---------- Konto-Aufgaben ---------- */
.auf-kopfzeile { color: var(--warn); font-size: 14px; font-weight: 600; margin: 0 4px 12px; }
.aufgabe { margin-bottom: 14px; border-left: 3px solid var(--border); }
.aufgabe.blocker { border-left-color: var(--warn); }
.aufgabe.hinweis { border-left-color: var(--accent); }
.auf-kopf { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.auf-punkt { width: 9px; height: 9px; border-radius: 99px; background: var(--warn); margin-top: 6px; flex: 0 0 auto; }
.aufgabe.hinweis .auf-punkt { background: var(--accent); }
.auf-titel { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.auf-titel strong { font-size: 15.5px; }
.auf-acc { font-size: 12.5px; color: var(--muted); }
.auf-tag {
  margin-left: auto; flex: 0 0 auto; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  border-radius: 99px; padding: 3px 10px; background: var(--accent-dim); color: var(--accent);
}
.auf-tag.stop { background: #fbbf2422; color: var(--warn); }
.auf-text { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0 0 12px; }
.auf-knoepfe { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.auf-knoepfe a.btn { text-decoration: none; }
.auf-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.auf-form .form-grid { margin-bottom: 14px; }
.auf-schutz {
  background: var(--accent-dim); color: var(--accent); border-radius: 10px;
  padding: 10px 13px; font-size: 12.5px; line-height: 1.5; margin-bottom: 14px;
}
.field label .opt { color: var(--muted); font-weight: 400; }
.empty-box { text-align: center; padding: 40px 24px; }
.empty-box .empty-ico { font-size: 34px; margin-bottom: 10px; }
.sheet-badge {
  margin-left: auto; background: var(--warn); color: #2a1c00;
  font-size: 12px; font-weight: 700; border-radius: 99px; padding: 1px 9px;
}

.main { flex: 1; min-width: 0; padding: 26px 30px 90px; max-width: 1060px; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { font-size: 21px; letter-spacing: -0.02em; }
.page-head .spacer { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 99px; padding: 5px 12px; color: var(--muted);
}
.pill .st { width: 8px; height: 8px; border-radius: 99px; background: var(--muted); }
.pill.on .st { background: var(--accent); }
.pill.on { color: var(--text); }
.pill.off .st { background: var(--danger); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.card.pad { padding: 20px; }

.tabs { display: inline-flex; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.tabs button { background: none; border: none; color: var(--muted); padding: 7px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 500; }
.tabs button.active { background: var(--panel2); color: var(--text); }

.empty { color: var(--muted); text-align: center; padding: 44px 20px; font-size: 14.5px; }

/* ---------- Chats ---------- */
.chat-list { display: flex; flex-direction: column; }
.chat-row {
  display: flex; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border);
  cursor: pointer; align-items: center;
}
.chat-row:last-child { border-bottom: none; }
.chat-row:hover { background: var(--panel2); }
.chat-row .avatar {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px; background: var(--panel2);
  border: 1px solid var(--border); display: grid; place-items: center; font-weight: 700; color: var(--accent);
}
/* Artikelfoto in der Chatliste — gleiche Maße wie der Buchstaben-Kreis, damit
   die Zeilen gleich hoch bleiben, egal ob ein Foto vorliegt. */
.chat-row .chat-foto {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 12px;
  object-fit: cover; background: var(--panel2); border: 1px solid var(--border);
}
.chat-row .mid { flex: 1; min-width: 0; }
.chat-row .top { display: flex; gap: 8px; align-items: baseline; }
.chat-row .buyer { font-weight: 600; font-size: 14.5px; }
.chat-row .item { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row .preview { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; }
.chat-row.open .preview { color: var(--text); }
.chat-row .meta { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.chat-row .time { color: var(--muted); font-size: 12px; }
.tag { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 2px 7px; background: var(--panel2); border: 1px solid var(--border); color: var(--muted); }
.tag.acc { color: var(--accent); }
.tag.offer { color: var(--warn); }
.dot-open { width: 9px; height: 9px; border-radius: 99px; background: var(--accent); }
.chat-row .chat-ign { font-size: 11.5px; padding: 3px 9px; white-space: nowrap; margin-top: 2px; }

/* Chat-Detail */
.chat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.chat-head .back { background: var(--panel); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 8px 12px; }
/* Artikelfoto oben im geöffneten Chat — man sieht sofort, worum es geht */
.chat-head-foto {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 10px;
  object-fit: cover; background: var(--panel2); border: 1px solid var(--border);
}
.chat-head .who .b { font-weight: 650; }
.chat-head .who .i { color: var(--muted); font-size: 13px; }
.bubbles { display: flex; flex-direction: column; gap: 8px; padding: 20px; max-height: 56vh; overflow-y: auto; }
.bubble { max-width: 76%; padding: 10px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.bubble.them { background: var(--panel2); border: 1px solid var(--border); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.us { background: var(--accent-dim); border: 1px solid #34d39944; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.event { background: none; border: none; color: var(--muted); font-size: 12.5px; align-self: center; text-align: center; }
.bubble.offer { border-color: var(--warn); }
.offer-bar {
  display: flex; gap: 10px; align-items: center; padding: 14px 18px; flex-wrap: wrap;
  border-top: 1px solid var(--border); background: var(--panel2);
}
.offer-bar .lbl { font-size: 13.5px; color: var(--warn); font-weight: 600; }
.offer-bar .hint { margin-right: auto !important; font-size: 12.5px; }
/* Preis-anbieten-Knopf deutlich sichtbar (wurde sonst leicht übersehen) */
.offer-bar .offerbtn { background: var(--warn); border-color: var(--warn); color: #14171f; font-weight: 700; }
.offer-bar .offerbtn:hover { filter: brightness(1.08); }
.reply-bar { display: flex; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); align-items: flex-start; }
.reply-bar textarea { flex: 1; min-height: 44px; max-height: 140px; }
.reply-btns { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.reply-btns .btn { white-space: nowrap; }

/* ---------- Karten-Gitter (Anzeigen/Verkäufe) ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 16px 18px; }
.stat .n { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.item-card { overflow: hidden; display: flex; flex-direction: column; }
.item-card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--panel2); display: block; }
.item-card .noimg { width: 100%; aspect-ratio: 1; display: grid; place-items: center; color: var(--muted); background: var(--panel2); }
.item-card .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.item-card .t { font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-card .row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.item-card .up-date { margin-left: auto; font-size: 12px; white-space: nowrap; }
.item-card .price { color: var(--text); font-weight: 650; }
.item-card .actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; padding-top: 10px; }
.item-card .actions > * { flex: 1 1 auto; white-space: nowrap; text-align: center; justify-content: center; }
.sale-row { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.sale-row:last-child { border-bottom: none; }
.sale-row img, .sale-row .noimg { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--panel2); flex-shrink: 0; }
.sale-row .noimg { display: grid; place-items: center; color: var(--muted); }
.sale-row .mid { flex: 1; min-width: 0; }
.sale-row .t { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sale-row .d { color: var(--muted); font-size: 12.5px; }
.sale-row .p { font-weight: 700; }
/* Paket-Einzelteile (Mini-Galerie in Verkäufen + Versand) */
.bundle-items { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.bundle-items .bi { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 5px 10px 5px 5px; }
.bundle-items .bi img, .bundle-items .bi .noimg { width: 38px; height: 38px; border-radius: 7px; object-fit: cover; background: var(--panel2); display: grid; place-items: center; flex-shrink: 0; font-size: 16px; }
.bundle-items .bi .bt { font-size: 12.5px; }
.bundle-items .bi .bs { color: var(--muted); font-size: 11px; }

/* Abo / Testphase */
.claim-box { border: 1px solid var(--accent); background: var(--accent-dim); border-radius: 12px; padding: 15px; margin: 18px 0 14px; }
.claim-title { font-weight: 650; font-size: 14.5px; margin-bottom: 4px; }
.claim-sub { color: var(--muted); font-size: 13px; line-height: 1.5; margin-bottom: 12px; }
.manual { border: 1px solid var(--border); border-radius: 12px; padding: 12px 15px; }
.manual summary { color: var(--muted); font-size: 13px; cursor: pointer; }
.manual summary::marker { color: var(--muted); }
.auth-card.wide { max-width: 460px; }
.trial-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--accent-dim); border: 1px solid var(--accent); color: var(--text); border-radius: 12px; padding: 10px 15px; margin-bottom: 18px; font-size: 13.5px; }
.trial-bar a { color: var(--accent); font-weight: 600; }

/* Versandscheine */
.label-row { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.label-row:last-child { border-bottom: none; }
.label-row img, .label-row .noimg { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; background: var(--panel2); flex-shrink: 0; }
.label-row .noimg { display: grid; place-items: center; color: var(--muted); }
.label-row .mid { flex: 1; min-width: 160px; }
.label-row .t { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-row .d { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.label-row .right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.label-row .lsel { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.label-row .preview { width: 54px; height: 72px; border-radius: 8px; border: 1px solid var(--border); background: #fff; flex-shrink: 0; overflow: hidden; position: relative; display: block; cursor: zoom-in; }
.label-row .preview .pdfthumb { display: block; width: 54px; height: auto; }
.label-row .meta2 { color: var(--muted); font-size: 12px; margin-top: 3px; }
.label-row .meta2 b { color: var(--text); font-weight: 600; }
/* Versandschein-Vorschau + Produktbild(er) nebeneinander */
.label-row .labelmedia { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.label-row .prodimg { width: 54px; height: 72px; border-radius: 8px; object-fit: cover; background: var(--panel2); flex-shrink: 0; }
.label-row .noimg.prodimg { width: 54px; height: 72px; display: grid; place-items: center; color: var(--muted); font-size: 20px; }
.bundle-list { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.bundle-list .bl { font-size: 12px; color: var(--muted); }
.tag.ok { color: var(--accent); border-color: var(--accent); }

/* ---------- Lager ---------- */
.lager-add { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lager-add .input { max-width: 220px; }
.lager-wrap { overflow-x: auto; }
.lager-table { min-width: 560px; }
.lgh, .lgr { display: grid; gap: 10px; align-items: center; padding: 8px 6px; }
.lt-bestand .lgh, .lt-bestand .lgr { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
.lt-unterwegs .lgh, .lt-unterwegs .lgr { grid-template-columns: 2.4fr 1fr 1fr auto; }
.lgh { color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border); }
.lgr { border-bottom: 1px solid var(--border); }
.lgr:last-child { border-bottom: none; }
.lgr .input { padding: 7px 9px; width: 100%; }
.lgr .lgname { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.lgacts { display: flex; gap: 6px; }
/* Teilmengen einbuchen: Stückzahl-Feld + Knopf */
.lgarrbox { display: flex; gap: 6px; align-items: center; }
.lgarrbox .lgarrn { width: 64px; text-align: center; padding: 6px 4px; }
.lgval { font-weight: 600; white-space: nowrap; }
.sale-row .lager-assign { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.lager-pick { display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; margin: 5px 0; background: var(--bg); }
.lager-pick label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }

/* Modal + Bearbeiten-Formular (Archiv/Anzeigen) */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: flex-start; justify-content: center; padding: 24px 14px; overflow-y: auto; z-index: 100; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 480px; margin: auto; }
.dedit-form { display: flex; flex-direction: column; gap: 9px; }
.dedit-form > label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.dedit-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.dedit-form .row2 > label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.dedit-photos { display: flex; flex-wrap: wrap; gap: 6px; }
.dedit-photos img { width: 46px; height: 60px; object-fit: cover; border-radius: 6px; background: var(--panel2); }
.filelabel { flex-direction: row !important; align-items: center; gap: 6px; cursor: pointer; color: var(--accent) !important; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; justify-content: center; }
.dedit-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }

/* Kategorie-Auswahl (Archiv-Neuanlage): Vorschläge + Suchergebnisse */
.cat-chosen { color: var(--accent); font-weight: 600; }
.cat-sugg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cat-chip { font-size: 12px; border: 1px solid var(--accent); color: var(--accent); background: transparent; border-radius: 999px; padding: 5px 10px; cursor: pointer; }
.cat-chip:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.cat-results { display: flex; flex-direction: column; gap: 2px; max-height: 190px; overflow-y: auto; }
.cat-results:not(:empty) { border: 1px solid var(--border); border-radius: 8px; padding: 4px; background: var(--panel2); }
.cat-row { text-align: left; font-size: 12.5px; color: var(--text); background: transparent; border: 0; border-radius: 6px; padding: 6px 8px; cursor: pointer; }
.cat-row:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* Fotos im Bearbeiten-Fenster: einzeln entfernbar */
.fotoslot { position: relative; display: inline-block; line-height: 0; }
.fotoslot .fotodel { position: absolute; top: -5px; right: -5px; width: 19px; height: 19px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--danger); color: #fff; font-size: 11px; line-height: 1;
  cursor: pointer; padding: 0; display: grid; place-items: center; }
.fotoslot .fotodel:hover { filter: brightness(1.15); }
.fotoslot .fotodel:disabled { opacity: .5; cursor: default; }
.preis-ergebnis:not(:empty) { margin: 6px 0 2px; }

/* Vinted-Preisempfehlung im Archiv */
.preisemp { display: flex; gap: 5px; margin: 4px 0 2px; }
.preisemp .pe { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: var(--panel2); border: 1px solid var(--border); border-radius: 7px; padding: 4px 2px;
  font-size: 12px; font-weight: 650; }
.preisemp .pe i { font-style: normal; font-size: 9.5px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.preisemp .pe-mid { border-color: var(--accent); color: var(--accent); }

/* AdsPower-Abgleich: Ergebnisblöcke */
.sync-box { background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.sync-box.warnbox { border-color: var(--warn); }
.sync-z { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.sync-z .warn { color: var(--warn); }

/* Verkaufszeile: Versandschein + Neu einstellen nebeneinander */
.sale-acts { display: flex; gap: 5px; align-items: center; flex-shrink: 0; }

/* Paket-Anfrage: die einzelnen Artikel unter dem Namen */
.chat-bundle { display: flex; flex-wrap: wrap; gap: 5px; margin: 3px 0 2px; }
.chat-bundle .cb {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 5px; padding: 2px 7px;
}
/* Kleines Foto je Einzelartikel eines Pakets */
.chat-bundle .cb img { width: 18px; height: 18px; border-radius: 4px; object-fit: cover; }

/* ---------- Versandschein-Stand in der Verkaufsliste ---------- */
.vchip {
  font-size: 11px; font-weight: 600; border-radius: 6px; padding: 2px 7px;
  white-space: nowrap; border: 1px solid var(--border); background: var(--panel2);
}
.vchip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.vchip.wait { color: var(--muted); }
.vchip.ok   { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.vchip.done { color: var(--muted); opacity: 0.75; }

.versand-uebersicht {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin: 0 0 14px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
}
.versand-uebersicht .vlink { color: var(--accent); font-size: 12px; text-decoration: none; margin-left: auto; }
.versand-uebersicht .vlink:hover { text-decoration: underline; }

/* Chat-Zeile: Ignorieren + Blockieren nebeneinander */
.chat-acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Sammelaktionen (Anzeigen) ---------- */
.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; }
.bulkbar .bulkall { margin: 0; font-size: 13px; }
.bulkbar .bulkcount { color: var(--muted); font-size: 12.5px; }
.bulkbar .spacer { flex: 1; }
.item-card { position: relative; }
.item-card .isel { position: absolute; top: 10px; left: 10px; z-index: 2; width: 20px; height: 20px; cursor: pointer; accent-color: var(--accent); border-radius: 4px; box-shadow: 0 0 0 3px rgba(0,0,0,.45); }

/* ---------- Statistik ---------- */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 68px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .bl { color: var(--muted); }
.bar-row .bt { background: var(--panel2); border-radius: 999px; height: 12px; overflow: hidden; }
.bar-row .bf { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar-row .bv { white-space: nowrap; font-weight: 600; }
.sttab { display: flex; flex-direction: column; gap: 2px; overflow-x: auto; }
.sth, .str { display: grid; grid-template-columns: 1.6fr .8fr 1fr .8fr .9fr .6fr; gap: 8px; align-items: center; padding: 7px 4px; font-size: 13px; min-width: 460px; }
.sth.bs, .str.bs { grid-template-columns: 2.4fr .8fr 1fr; }
.sth.lh, .str.lh { grid-template-columns: 2fr 1fr .8fr .6fr .6fr .6fr; }
.sth { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border); }
.str { border-bottom: 1px solid rgba(255,255,255,.04); }
.str:last-child { border-bottom: 0; }
.str span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Formulare / Accounts / Einstellungen ---------- */
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); flex-shrink: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 700px) { .grid-3 { grid-template-columns: 1fr; } }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; line-height: 1.5; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  width: 100%; padding: 26px 18px; text-align: center;
  background: var(--panel2); color: var(--text);
  border: 1.5px dashed var(--border); border-radius: 14px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-dim); }
.dropzone.filled { border-style: solid; border-color: var(--accent); }
.dropzone .dz-ico { font-size: 24px; line-height: 1; }
.dropzone .dz-main { font-weight: 600; font-size: 15px; }
.dropzone .dz-sub { font-size: 12.5px; color: var(--muted); }
.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-strip .ph-tag {
  position: absolute; left: 3px; bottom: 3px; background: #000b; color: #fff;
  font-size: 10px; padding: 2px 6px; border-radius: 6px;
}
.photo-strip .ph { position: relative; width: 74px; height: 74px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.photo-strip .ph img { width: 100%; height: 100%; object-fit: cover; }
.photo-strip .ph button { position: absolute; top: 2px; right: 2px; background: #000a; color: #fff; border: none; border-radius: 6px; width: 20px; height: 20px; font-size: 11px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid var(--border); background: var(--panel); color: var(--muted); border-radius: 99px; padding: 6px 13px; font-size: 13px; }
.chip.sel { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.cat-results { max-height: 230px; overflow-y: auto; margin-top: 8px; border: 1px solid var(--border); border-radius: 10px; }
.cat-results button { display: block; width: 100%; text-align: left; padding: 10px 13px; background: none; border: none; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 13.5px; }
.cat-results button:hover, .cat-results button.sel { background: var(--panel2); color: var(--text); }

.acc-row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.acc-row:last-child { border-bottom: none; }
.acc-row .info { flex: 1; min-width: 180px; }
.acc-row .name { font-weight: 600; }
.acc-row .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.switch { position: relative; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; background: var(--panel2); border: 1px solid var(--border); border-radius: 99px; transition: 0.15s; }
.switch .sl::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 99px; background: var(--muted); transition: 0.15s; }
.switch input:checked + .sl { background: var(--accent-dim); border-color: var(--accent); }
.switch input:checked + .sl::before { transform: translateX(18px); background: var(--accent); }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; overflow-x: auto; white-space: pre; line-height: 1.6;
}
.kv { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.log-box { max-height: 300px; overflow-y: auto; font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.7; color: var(--muted); }
.section-title { font-size: 15px; font-weight: 650; margin: 26px 0 10px; }
.section-title:first-child { margin-top: 0; }

/* ---------- Toast / Mobile ---------- */
#toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 18px; border-radius: 12px; font-size: 14px; opacity: 0;
  pointer-events: none; transition: opacity 0.2s; z-index: 50; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; }
#toast.err { border-color: var(--danger); }

/* ---------- Protokoll ---------- */
.log-list { max-height: calc(100vh - 260px); overflow-y: auto; padding: 4px 0; }
.log-row {
  display: flex; gap: 14px; padding: 9px 18px; font-size: 13.5px; line-height: 1.5;
  border-bottom: 1px solid #ffffff08; align-items: baseline;
}
.log-row:last-child { border-bottom: none; }
.log-time { color: #6b7987; font-variant-numeric: tabular-nums; flex-shrink: 0; font-size: 12.5px; }
.log-text { color: #c8d3df; word-break: break-word; }
.log-text .log-acc { margin-right: 7px; vertical-align: 1px; }
.log-row.ok .log-text { color: #a8e9c9; }
.log-row.warn { background: #f0b73a0d; }
.log-row.warn .log-text { color: #f0cd7e; }
.log-row.error { background: #ff5f570f; }
.log-row.error .log-text { color: #ffa39c; }

/* ---------- Handy ---------- */
.tabbar { display: none; }
.sheet-backdrop { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }

  /* Kopfzeile bleibt beim Scrollen stehen — man weiß immer, wo man ist */
  .page-head {
    position: sticky; top: 0; z-index: 20; margin: -16px -14px 14px; padding: 14px;
    background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 8px;
  }
  .page-head h2 { font-size: 20px; }

  /* Eingaben: 16px verhindert das automatische Hineinzoomen auf dem iPhone */
  .input, textarea.input, select.input { font-size: 16px; padding: 13px 14px; }
  select.input { background-position: right 16px center; }
  .field label { font-size: 13.5px; }
  .btn { padding: 13px 18px; font-size: 15px; }
  .btn.small { padding: 9px 14px; font-size: 13.5px; }
  .form-grid { grid-template-columns: 1fr; }

  /* Karten und Listen: eine Spalte, größere Tippflächen */
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .item-card .t { font-size: 13.5px; }
  .item-card .actions { flex-wrap: wrap; }
  .stat-row { grid-template-columns: 1fr 1fr; }

  .chat-row, .sale-row, .label-row, .acc-row { padding: 14px; }

  /* Verkaufszeile: Seit der Versandschein-Stand und zwei weitere Knöpfe
     dazugekommen sind, passt die Aktionsleiste nicht mehr neben den Text —
     sie lief rechts aus der Karte heraus. Auf schmalen Geräten bekommt sie
     deshalb eine eigene Zeile über die volle Breite. */
  .sale-row { flex-wrap: wrap; }
  .sale-row .mid { flex: 1 1 60%; }
  .sale-row .p { margin-left: auto; }
  .sale-acts {
    flex-basis: 100%; flex-wrap: wrap; justify-content: flex-end;
    gap: 8px; margin-top: 4px;
  }
  .sale-acts .btn.small { padding: 9px 12px; }
  .versand-uebersicht { padding: 10px; gap: 6px; }
  .versand-uebersicht .vlink { margin-left: 0; flex-basis: 100%; }
  .label-row .right { width: 100%; justify-content: flex-end; }
  .acc-row { gap: 10px; }
  .acc-row .info { flex-basis: 100%; }

  /* Chat: volle Höhe, Eingabe immer erreichbar */
  .bubbles { max-height: none; }

  /* Protokoll: mehr Platz, Zeit über den Text wenn es eng wird */
  .log-list { max-height: none; }
  .log-row { padding: 10px 14px; gap: 10px; }

  .chips { gap: 6px; }
  .chip { padding: 8px 13px; font-size: 13px; }
  /* Filterleisten laufen seitlich weiter statt über drei Zeilen */
  .chips-scroll {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin: 0 -14px; padding: 2px 14px; scroll-padding: 14px;
  }
  .chips-scroll::-webkit-scrollbar { display: none; }
  .chips-scroll .chip { flex: 0 0 auto; }

  /* Untere Leiste: fünf Einträge, der Rest im „Mehr"-Menü */
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
    background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(16px);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar button {
    flex: 1; background: none; border: none; color: var(--muted); font-size: 10.5px;
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0;
    min-width: 0; overflow: hidden; position: relative;
  }
  .tabbar button span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar button.active { color: var(--accent); }
  .tabbar .badge.warn { background: var(--warn); color: #2a1c00; }
  .tabbar .ico { font-size: 20px; line-height: 1; }
  .tabbar .badge {
    position: absolute; top: 2px; right: 50%; transform: translateX(20px);
    background: var(--accent); color: #04120c; font-size: 10px; font-weight: 800;
    min-width: 17px; padding: 1px 5px; border-radius: 9px; line-height: 1.5;
  }

  /* „Mehr"-Menü als Blatt von unten */
  .sheet-backdrop {
    display: block; position: fixed; inset: 0; z-index: 50;
    background: #000a; backdrop-filter: blur(3px);
    opacity: 0; pointer-events: none; transition: opacity .18s;
  }
  .sheet-backdrop.open { opacity: 1; pointer-events: auto; }
  .sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
    background: var(--panel); border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0; padding: 10px 12px calc(18px + env(safe-area-inset-bottom));
    transform: translateY(100%); transition: transform .22s cubic-bezier(.32,.72,0,1);
  }
  .sheet-backdrop.open .sheet { transform: translateY(0); }
  .sheet .griff { width: 40px; height: 4px; border-radius: 99px; background: #3a4653; margin: 6px auto 14px; }
  .sheet button {
    display: flex; align-items: center; gap: 14px; width: 100%;
    background: none; border: none; color: var(--text); font-size: 16px;
    padding: 15px 12px; border-radius: 12px; text-align: left;
  }
  .sheet button.active { background: #ffffff0d; color: var(--accent); }
  .sheet button .ico { font-size: 20px; width: 26px; text-align: center; }
}

@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .log-time { display: block; }

  /* Auf sehr schmalen Geräten nur die Symbole zeigen — die Beschriftung steht
     weiterhin im Tooltip und wird beim langen Antippen eingeblendet. */
  .sale-acts .btxt { display: none; }
  .sale-acts .btn.small { padding: 9px 11px; }
}


/* ---------- Betreiber-Übersicht ---------- */
.kundenliste { display: grid; gap: 12px; }
.kunde {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  transition: border-color .15s;
}
.kunde:hover { border-color: #33415a; }
.ku-kopf { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ku-mail { font-weight: 650; font-size: 15.5px; letter-spacing: -0.01em; }

/* Zustandsmarken. Farbe trägt hier Bedeutung — deshalb steht sie NIE allein,
   sondern immer zusammen mit dem Wort („zahlend", „Agent offline"). */
.marke {
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  border-radius: 999px; padding: 3px 10px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--panel2); color: var(--muted);
}
.marke.gut { color: var(--accent); border-color: #34d39955; background: var(--accent-dim); }
.marke.warnung { color: var(--warn); border-color: #fbbf2455; background: #fbbf2418; }
.marke.schlecht { color: var(--danger); border-color: #f8717155; background: #f8717118; }

.ku-zahlen {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px;
  font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums;
}
.ku-fuss { margin-top: 10px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.ku-fehler {
  margin-top: 10px; padding: 9px 12px; border-radius: 10px;
  background: #f8717112; border: 1px solid #f8717133;
  color: #ffb4b4; font-size: 13px; line-height: 1.45;
}

/* Die sechs Kennzahlen der Betreiber-Übersicht sind kurze Zahlen — die passen
   auch auf schmalen Geräten zu zweit nebeneinander. Sonst wären es sechs
   Bildschirme Scrollen, bevor die erste Kundenzeile kommt. */
@media (max-width: 420px) {
  .stat-row.admin-zahlen { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .kunde { padding: 14px; }
  .ku-zahlen { gap: 6px 14px; font-size: 13.5px; }
  .ku-kopf .spacer { display: none; }
}

/* Betreiber-Protokoll: eine Zeile je Eintrag, Zeit und Kunde links, damit man
   beim Überfliegen sofort sieht, wen es betrifft. Auf dem Handy bricht die
   Zeile um, statt seitlich hinauszulaufen. */
.protokoll { display: flex; flex-direction: column; gap: 2px; max-height: 62vh; overflow: auto; }
.prot-zeile {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 7px 8px; border-radius: 8px; font-size: 13.5px; line-height: 1.45;
}
.prot-zeile:nth-child(odd) { background: rgba(255, 255, 255, 0.022); }
.prot-fehler { background: rgba(248, 113, 113, 0.09) !important; }
.prot-warn { background: rgba(251, 191, 36, 0.07) !important; }
.prot-zeit { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12.5px; }
.prot-kunde {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; font-size: 12.5px; white-space: nowrap;
}
.prot-kunde:hover { text-decoration: underline; }
.prot-text { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .protokoll { max-height: none; }
  .prot-text { flex-basis: 100%; }
}
