/* ---------- Anmelden ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-box { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: grid; gap: 18px; }
.center-brand { justify-content: center; }
.auth-switch { justify-self: center; }
.stack { display: grid; gap: 14px; }
textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font: inherit; font-weight: 400; color: inherit; resize: vertical; }
.msg { min-height: 1em; margin: 0; font-weight: 600; color: #12b76a; }
.msg.bad { color: #e5484d; }

label.check { align-items: flex-start; font-weight: 400; font-size: 14px; }
label.check input { margin-top: 3px; flex: none; }
label.check a, .avv-modal a { color: var(--accent-text); }
.avv-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }
.avv-modal { position: fixed; z-index: 41; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(480px, calc(100% - 32px)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.avv-modal h2 { margin: 0; font-size: 20px; }
.avv-modal p { margin: 0; line-height: 1.5; }

/* ---------- Grundgerüst ---------- */
.app { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.side nav { display: grid; gap: 2px; }
.side nav a { color: inherit; text-decoration: none; padding: 9px 12px; border-radius: 10px; font-size: 15px; }
.side nav a:hover { background: var(--bg); }
.side nav a.active { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-text); font-weight: 600; }
.side-foot { margin-top: auto; display: grid; gap: 8px; justify-items: start; word-break: break-all; }
.content { padding: 28px; max-width: 1100px; width: 100%; }
.content h1 { margin: 0 0 18px; font-size: 24px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.box h3 { margin: 0 0 14px; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side, .side nav { min-width: 0; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side nav { display: flex; overflow-x: auto; width: 100%; order: 3; scrollbar-width: none; }
  .side nav a { white-space: nowrap; }
  .side-foot { margin: 0 0 0 auto; display: flex; align-items: center; }
  .side-foot .muted, .side-foot .side-legal { display: none; }
  .content { padding: 16px; }
  .grid2 { grid-template-columns: 1fr; }
}

/* ---------- Kennzahlen ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .k-val { font-size: 28px; font-weight: 700; margin-top: 4px; }
.kpi .k-lbl { font-size: 13px; color: var(--muted); }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Balkendiagramme ---------- */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; min-width: 0; }
.bars .bar i { display: block; width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; opacity: .85; }
.bars .bar.top i { opacity: 1; }
.bars .bar span { font-size: 11px; color: var(--muted); }
.bars:not(.labeled) .bar span { display: none; }
.bars .bar:hover i { opacity: 1; }

/* ---------- Karte gestalten ---------- */
.design { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.design-preview { display: grid; justify-items: center; gap: 14px; position: sticky; top: 20px; }
@media (max-width: 1000px) { .design { grid-template-columns: 1fr; } .design-preview { position: static; } }

/* ---------- Kunden ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 180px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--bg); border: 1px solid var(--line); }

/* ---------- Nachrichten ---------- */
.msg-foot { display: flex; justify-content: space-between; align-items: center; }
.msg-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; max-height: 420px; overflow: auto; }
.msg-list li { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.msg-list time { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- Aufsteller ---------- */
.poster { width: 100%; max-width: 380px; aspect-ratio: 105 / 148; margin: 0 auto; background: var(--c, #222); color: var(--fg, #fff); border-radius: 18px; padding: 28px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.poster .p-logo { width: 64px; height: 64px; border-radius: 16px; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 32px; overflow: hidden; }
.poster .p-logo img { width: 100%; height: 100%; object-fit: cover; }
.poster h2 { margin: 0; font-size: 24px; }
.poster .p-big { font-size: 20px; font-weight: 700; margin: 4px 0 0; }
.poster .p-qr { background: #fff; padding: 14px; border-radius: 14px; width: 62%; margin-top: auto; }
.poster .p-qr img { width: 100%; display: block; }
.poster .p-foot { font-size: 12px; opacity: .8; margin-top: auto; }

.steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.steps a { color: var(--accent-text); word-break: break-all; }
code { background: var(--bg); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; }

@media print {
  body * { visibility: hidden; }
  .poster, .poster * { visibility: visible; }
  .poster { position: fixed; left: 0; top: 0; width: 105mm; max-width: none; height: 148mm; border-radius: 0; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A6; margin: 0; }
}

/* Stempel-Motiv */
.stamp-styles { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.stamp-styles label { font-weight: 500; }
.tier-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; margin-bottom: 8px; }

/* Kundengruppen */
.sel { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font: inherit; }
.toolbar .sel { width: auto; }
.grp { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.grp.regular { background: #e8f7ee; color: #0b6b3a; }
.grp.new { background: #eef1ff; color: #2b3fb8; }
.grp.casual { background: #fff4e5; color: #8a4b00; }
.grp.inactive { background: #f1f1f3; color: #555; }
.groups { display: grid; gap: 10px; }
.grp-row { display: grid; grid-template-columns: 130px 1fr 40px; gap: 4px 12px; align-items: center; text-decoration: none; color: inherit; }
.grp-row:hover strong { color: var(--accent-text); }
.grp-bar { height: 10px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.grp-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); min-width: 2px; }
.grp-bar i.regular { background: #12b76a; } .grp-bar i.new { background: #3d5afe; } .grp-bar i.casual { background: #f5a524; } .grp-bar i.inactive { background: #98a2b3; }
.grp-row strong { text-align: right; }
.grp-help { grid-column: 1 / -1; margin-top: -4px; }

/* Letzte Aktivitäten */
.activity { list-style: none; margin: 0; padding: 0; display: grid; max-height: 360px; overflow: auto; }
.activity li { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: center; }
.activity time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.act-ic { text-align: center; }

/* Automatische Nachrichten */
.sub-h { margin: 32px 0 6px; font-size: 20px; }
.auto-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin: 12px 0; }
.auto-item { display: grid; gap: 10px; align-content: start; }
.auto-item textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); resize: vertical; }
.inline-num { display: flex !important; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; }
.inline-num input { width: 80px !important; flex: none; }

/* Stempel-Links */
.link-list { display: grid; gap: 10px; }
.link-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.link-item.off { opacity: .55; }
.link-item code { font-size: 12px; word-break: break-all; }
.link-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.link-actions a { text-decoration: none; color: inherit; font-size: 13px; }

/* Feedback */
.fb-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.fb-item { display: grid; grid-template-columns: 40px 1fr; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.fb-item.r3 { border-left-color: #12b76a; } .fb-item.r2 { border-left-color: #f5a524; } .fb-item.r1 { border-left-color: #d92d20; }
.fb-face { font-size: 26px; line-height: 1; }
.fb-item p { margin: 6px 0 0; }
.switch-row { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; }
.switch-row input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
