@font-face { font-family: "Assistant"; font-weight: 400; src: url("/assets/Assistant-Regular.ttf"); }
@font-face { font-family: "Assistant"; font-weight: 600; src: url("/assets/Assistant-SemiBold.ttf"); }

:root {
  --pink: #F6C2C2;
  --pink-soft: #FDF1F1;
  --pink-deep: #C9787A;
  --ink: #1a1a1a;
  --muted: #7b6f6f;
  --line: #ebe3e3;
  --err: #c0392b;
  --warn-bg: #fff6e5;
  --warn: #8a5a00;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.4 "Assistant", system-ui, sans-serif; color: var(--ink); background: #faf7f7; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar .logo { width: 36px; height: 36px; }
.topbar h1 { font-size: 19px; font-weight: 600; margin: 0; }
.topbar h1 span { font-weight: 400; color: var(--muted); }

.layout { flex: 1; display: grid; grid-template-columns: minmax(500px, 600px) 1fr; min-height: 0; }

/* ---------- links ---------- */
.left { display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line); min-height: 0; }
.left .scroll { flex: 1; overflow-y: auto; padding: 18px 20px 24px; }
h2 { font-size: 16px; font-weight: 600; margin: 22px 0 10px; padding: 4px 12px; background: var(--pink); border-radius: 13px; }
h3 { font-size: 14px; font-weight: 600; margin: 8px 0 0; }
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }

.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--pink-deep); border-radius: 16px; background: var(--pink-soft); cursor: pointer; transition: background .15s; }
.drop:hover, .drop.over { background: #fbe3e3; }
.drop.big { min-height: 320px; padding: 30px; }
.drop.big .drop-icon { font-size: 44px; color: var(--pink-deep); }
.drop.big .drop-title { font-size: 21px; font-weight: 600; }
.drop.small { flex-direction: row; gap: 8px; padding: 8px 12px; border-width: 1px; justify-content: flex-start; }
.drop.small .drop-icon { font-size: 16px; color: var(--pink-deep); }
.drop.small .drop-title { font-weight: 600; font-size: 14px; }
.drop.small .drop-sub { font-size: 13px; color: var(--muted); }

.info { margin-top: 12px; font-size: 14px; color: var(--muted); }
.info strong { color: var(--ink); }
.warnings { list-style: none; margin: 8px 0 0; padding: 0; }
.warnings li { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 6px 10px; margin-top: 6px; font-size: 14px; }
.warnings li::before { content: "⚠ "; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.span2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 3px; }
input, textarea, select { font: inherit; font-size: 15px; color: var(--ink); border: 1px solid #ddd2d2; border-radius: 8px; padding: 6px 9px; background: #fff; width: 100%; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--pink-deep); box-shadow: 0 0 0 3px #f6c2c255; }
.invalid { border-color: var(--err) !important; background: #fff5f4; }
.err { color: var(--err); font-size: 12px; min-height: 0; }
.err:empty { display: none; }
.hint { font-size: 12px; color: var(--muted); }
.hint:empty { display: none; }

table.rows { width: 100%; border-collapse: collapse; font-size: 14px; }
table.rows th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 2px 3px 6px; }
table.rows th.num { text-align: right; }
table.rows td { padding: 3px; border-top: 1px solid var(--line); vertical-align: middle; }
table.rows input, table.rows select { padding: 4px 6px; font-size: 14px; border-radius: 6px; }
table.rows input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--pink-deep); }
table.rows td.c-date { width: 136px; }
table.rows td.c-art { width: 136px; }
table.rows td.c-bestell input { min-width: 112px; }
table.rows td.c-betrag input { text-align: right; width: 82px; }
table.rows tr.off td:not(:first-child) { opacity: .4; }
table.rows tr.refund td.c-betrag input { color: var(--err); }
.del { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 6px; }
.del:hover { background: var(--pink-soft); color: var(--err); }

button { font: inherit; cursor: pointer; }
.link { background: none; border: none; color: var(--pink-deep); font-weight: 600; padding: 8px 0; }
.secondary { background: #fff; border: 1px solid #ddd2d2; border-radius: 8px; padding: 6px 12px; white-space: nowrap; }
.secondary:hover { border-color: var(--pink-deep); }
.primary { background: var(--ink); color: #fff; border: none; border-radius: 10px; padding: 11px 18px; font-weight: 600; font-size: 16px; width: 100%; }
.primary:hover:not(:disabled) { background: #3a2a2a; }
.primary:disabled { background: #cfc6c6; cursor: not-allowed; }

details#stammdaten { margin-top: 22px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
details#stammdaten summary { cursor: pointer; font-weight: 600; }
details#stammdaten[open] summary { margin-bottom: 10px; }
details#stammdaten .secondary { margin-top: 12px; }

.export { border-top: 1px solid var(--line); padding: 12px 20px 14px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.row-inline { display: flex; gap: 8px; }
.status { font-size: 13px; min-height: 18px; }
.status.ok { color: #2e7d4f; }
.status.bad { color: var(--err); }

/* ---------- rechts ---------- */
.right { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.preview-bar { display: flex; align-items: baseline; gap: 22px; padding: 12px 24px; background: #fff; border-bottom: 1px solid var(--line); }
.preview-bar .label { color: var(--muted); font-size: 13px; }
.preview-bar strong { font-size: 20px; }
.pageinfo { margin-left: auto; font-size: 14px; color: var(--muted); }
.right > .warnings { padding: 0 24px; }
.pages { flex: 1; overflow-y: auto; padding: 20px 24px 40px; display: flex; flex-direction: column; align-items: center; gap: 20px; transition: opacity .15s; }
.pages.busy { opacity: .6; }
.pages img { width: 100%; max-width: 760px; background: #fff; box-shadow: 0 2px 14px #0000001c; border-radius: 2px; display: block; }
.pages .empty { margin-top: 30vh; color: var(--muted); }
.qr { padding: 8px 24px 12px; border-top: 1px solid var(--line); background: #fff; font-size: 13px; }
.qr summary { cursor: pointer; color: var(--muted); }
.qr pre { margin: 6px 0 0; font-size: 12px; }

/* ---------- Kopfzeile: Archiv ---------- */
.archiv-btn { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.badge { background: var(--pink); color: var(--ink); border-radius: 10px; padding: 0 7px; font-size: 12px; font-weight: 600; }
.badge:empty { display: none; }
.badge-inline { font-size: 12px; font-weight: 600; border-radius: 10px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }
.badge-inline:empty { display: none; }
.badge-inline.ok { background: #e3f4ea; color: #2e7d4f; }
.badge-inline.warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- Hinweisbanner ---------- */
.banner { border: 1px solid #ecd9a8; background: var(--warn-bg); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; display: flex; flex-direction: column; gap: 8px; }
.banner.ok { border-color: #bfe0cb; background: #eef8f2; }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.primary.small, .secondary.small { width: auto; padding: 6px 12px; font-size: 14px; border-radius: 8px; text-decoration: none; color: inherit; display: inline-block; }
.primary.small { color: #fff; }

/* ---------- Anleitung ---------- */
.howto { margin-top: 14px; font-size: 14px; color: var(--muted); }
.howto summary { cursor: pointer; }
.howto ol { margin: 8px 0 0; padding-left: 20px; color: var(--ink); }
.howto li { margin: 3px 0; }
.howto code { background: var(--pink-soft); padding: 0 4px; border-radius: 4px; font-size: 13px; }

/* ---------- Monatsabgleich ---------- */
.abgleich { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; }
.abgleich summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.abgleich[open] summary { margin-bottom: 6px; }
table.abgl { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 8px; }
table.abgl caption { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding-bottom: 2px; }
table.abgl td { padding: 2px 0; border-bottom: 1px solid var(--line); }
table.abgl td.num, .num { text-align: right; white-space: nowrap; }
table.abgl tr.sum td { font-weight: 600; border-bottom: none; }
table.abgl.quiet { color: var(--muted); }
.small-note { font-size: 12px; margin: 8px 0 2px; }

/* ---------- Datumsfelder ---------- */
.date-wrap { position: relative; display: flex; }
.date-wrap .date-de { padding-right: 34px; }
.date-wrap .cal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: none; background: none; cursor: pointer; font-size: 15px; padding: 2px 4px; opacity: .65; }
.date-wrap .cal:hover { opacity: 1; }
.date-wrap .picker { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
table.rows td.c-date input { width: 100%; }

.row-actions { display: flex; gap: 18px; flex-wrap: wrap; }
.muted-link { color: var(--muted) !important; font-weight: 400 !important; }

/* ---------- Archiv-Panel ---------- */
.overlay { position: fixed; inset: 0; background: #2a1f1f55; display: flex; justify-content: flex-end; z-index: 20; }
.panel { width: min(640px, 100%); height: 100%; background: #fff; padding: 18px 22px; overflow-y: auto; box-shadow: -4px 0 24px #0002; }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { margin: 0; }
.archiv-tab { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 10px; }
.archiv-tab th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px; }
.archiv-tab td { padding: 8px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.archiv-tab td:first-child { white-space: nowrap; }
.archiv-tab td.actions { white-space: nowrap; text-align: right; }
.empty-small { color: var(--muted); margin-top: 20px; }
.archiv-tab tr.ungueltig td:not(.actions) { color: var(--muted); }
.archiv-tab tr.ungueltig td:first-child strong { text-decoration: line-through; }
.archiv-tab .hinweis { margin-top: 4px; font-size: 12px; color: var(--warn); background: var(--warn-bg); border-radius: 6px; padding: 2px 6px; display: inline-block; }

/* ---------- Handy & Tablet ---------- */
@media (max-width: 900px) {
  body { display: block; height: auto; }
  .topbar { position: sticky; top: 0; z-index: 10; padding: 8px 14px; }
  .topbar h1 span { display: none; }
  .layout { display: block; }
  .left { border-right: none; }
  .left .scroll { overflow: visible; padding: 14px; }
  .export { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; box-shadow: 0 -4px 14px #0001; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  body:has(#export-bar:not([hidden])) { padding-bottom: 90px; }
  .right { overflow: visible; border-top: 6px solid var(--pink-soft); }
  .preview-bar { flex-wrap: wrap; gap: 4px 14px; padding: 10px 14px; position: sticky; top: 52px; z-index: 4; }
  .pageinfo { margin-left: 0; }
  .right > .warnings { padding: 0 14px; }
  .pages { overflow: visible; padding: 14px; }
  .drop.big { min-height: 200px; }
  input, select, textarea { font-size: 16px; }   /* verhindert das Hineinzoomen auf dem iPhone */
  .grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }

  /* Positionen als Karten: zwei Zeilen je Position */
  table.rows thead { display: none; }
  table.rows, table.rows tbody { display: block; }
  table.rows tr { display: grid; grid-template-columns: 28px 1fr 1fr 32px; grid-template-areas: "chk date art del" "chk bestell betrag del"; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line); }
  table.rows td { border: none; padding: 0; width: auto !important; }
  table.rows td.c-check { grid-area: chk; align-self: center; }
  table.rows td.c-date { grid-area: date; }
  table.rows td.c-art { grid-area: art; }
  table.rows td.c-bestell { grid-area: bestell; }
  table.rows td.c-betrag { grid-area: betrag; }
  table.rows td.c-betrag input { width: 100%; }
  table.rows td.c-bestell input { min-width: 0; }
  table.rows td.c-del { grid-area: del; align-self: center; }
  .archiv-tab td:nth-child(4), .archiv-tab th:nth-child(4) { display: none; }
}

/* ---------- Anmeldung ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 20px; background: var(--pink-soft); }
.login-card { width: min(380px, 100%); background: #fff; border-radius: 18px; padding: 28px 26px 24px; box-shadow: 0 6px 30px #c9787a22; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-logo { width: 84px; height: 84px; margin: 0 auto; }
.login-card h1 { margin: 0; font-size: 26px; font-weight: 600; }
.login-card > p { margin: -10px 0 4px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-card input { font-size: 16px; padding: 10px 12px; }
.login-card .check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.login-card .check input { width: 18px; height: 18px; accent-color: var(--pink-deep); }
.login-msg { border-radius: 10px; padding: 9px 12px; font-size: 14px; text-align: left; }
.login-msg.bad { background: #fdecea; color: var(--err); }
.login-msg.ok { background: #eef8f2; color: #2e7d4f; }
.logout-btn { margin-left: 8px; }

.acc-badge { border: none; background: #e3f4ea; color: #2e7d4f; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.acc-badge:hover { background: #d3ecdc; }
.archiv-tab td.actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Zwei-Faktor ---------- */
.zf-ok { color: #2e7d4f; font-weight: 600; }
.zf-schritte { padding-left: 20px; font-size: 14px; }
.zf-schritte li { margin: 6px 0; }
.zf-key { display: inline-block; margin-top: 4px; background: var(--pink-soft); padding: 2px 6px; border-radius: 6px; font-size: 14px; letter-spacing: .5px; user-select: all; }
.zf-qr { display: flex; justify-content: center; margin: 10px 0; }
.zf-qr svg { width: 220px; height: 220px; }
.zf-code { margin-top: 12px; }
.zf-code input { font-size: 20px; letter-spacing: 3px; text-align: center; }
.login-card .zurueck { text-align: center; }

/* ---------- Etsy-Verbindung ---------- */
.etsy-box { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.etsy-box .status { flex-basis: 100%; }
.etsy-ok { color: #2e7d4f; font-weight: 600; }
.etsy-laden { display: flex; gap: 8px; flex-basis: 100%; }
.etsy-laden select { flex: 1; }

/* ---------- Anmeldung: Links, Textseiten ---------- */
.login-links { text-align: center; font-size: 14px; color: var(--muted); }
.login-links a { color: var(--pink-deep); }
.login-card .check span a { color: var(--pink-deep); }
.hinweis-text { margin: 0; font-size: 14px; }
.text-seite { text-align: left; }

/* ---------- Einrichtungsassistent ---------- */
.schritte { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 6px; counter-reset: s; flex-wrap: wrap; }
.schritte li { counter-increment: s; font-size: 13px; color: var(--muted); padding: 4px 10px 4px 6px; border-radius: 12px; background: #f4eeee; cursor: default; }
.schritte li::before { content: counter(s); display: inline-block; width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 50%; background: #fff; margin-right: 6px; font-weight: 600; }
.schritte li.aktiv { background: var(--pink); color: var(--ink); font-weight: 600; }
.schritte li.fertig { background: #e3f4ea; color: #2e7d4f; cursor: pointer; }
.schritt h2 { margin-top: 14px; }
.logo-feld { display: flex; gap: 16px; align-items: flex-start; margin: 10px 0 16px; }
.logo-feld img { width: 96px; height: 96px; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.datei-knopf { cursor: pointer; display: inline-block; }
.schritt-knoepfe { justify-content: space-between; }
.schritt-knoepfe .primary { width: auto; flex: 1; }
input[type=color] { width: 52px; padding: 2px; height: 38px; }
.right .pages img#beispiel:not([src]) { display: none; }
a.secondary, a.primary { text-decoration: none; color: var(--ink); display: inline-flex; align-items: center; }

/* Rechtstexte */
.login-card.text-seite { width: min(760px, 100%); gap: 4px; line-height: 1.55; }
.text-seite h1 { text-align: left; margin-bottom: 8px; }
.text-seite h2 { font-size: 17px; margin: 18px 0 4px; }
.text-seite p, .text-seite ul { margin: 4px 0; font-size: 15px; }
.text-seite ul { padding-left: 20px; }
.text-seite a { color: var(--pink-deep); }
.text-zurueck { margin: 0 0 6px; font-size: 14px; }
.text-fuss { margin-top: 24px !important; font-size: 13px !important; text-align: center; }
.rechts-fuss { text-align: center; font-size: 12px; margin: 10px 0 0; }
.rechts-fuss a { color: var(--muted); }
.schritt h3 { font-size: 15px; margin: 18px 0 4px; }
.gefahr { color: #b3261e !important; border-color: #e3a29d !important; }
.gefahr:disabled { opacity: .5; cursor: not-allowed; }

/* Lange Seiten (Rechtstexte, kleine Handys): nicht über den oberen Rand hinaus zentrieren.
   justify-content: center schiebt überlange Inhalte nach oben aus dem scrollbaren Bereich; margin: auto zentriert nur, wenn Platz ist. */
.login-body { height: auto; justify-content: flex-start; align-items: stretch; }
.login-body > .login-card { margin: auto; }
