/* OfficeBau – schlicht, ruhig, gut lesbar */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --line: #e3e6eb;
  --line-strong: #cfd4dc;
  --text: #1b1f24;
  --muted: #667085;
  --accent: #2456d6;
  --accent-soft: #e9effd;
  --accent-text: #ffffff;
  --ok: #157f3b; --ok-soft: #e6f4ea;
  --warn: #9a5b00; --warn-soft: #fdf1dc;
  --bad: #c0262d; --bad-soft: #fde8e8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317; --surface: #1a1d23; --surface-2: #22262d; --line: #2c3139; --line-strong: #3a404a;
    --text: #e8eaed; --muted: #9aa3af; --accent: #6b8ff0; --accent-soft: #1f2a44; --accent-text: #0d1220;
    --ok: #5cc98a; --ok-soft: #173325; --warn: #e8b04f; --warn-soft: #3a2c12; --bad: #f2777c; --bad-soft: #3d1c1e;
    --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 600; }
small, .muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Grundlayout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; padding: 4px 10px 16px; color: var(--text); }
.logo-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-size: 13px; font-weight: 800; letter-spacing: -.5px; }
.logo-img { width: 30px; height: 30px; flex: none; display: block; }
.auth .logo-img { width: 40px; height: 40px; }
.print-title .logo-img { width: 28px; height: 28px; }
.auth-back { display: block; text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 12px 10px 0; font-size: 13px; }
.side-foot .who { font-weight: 600; }
.side-foot .co { color: var(--muted); margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { padding: 28px 32px 60px; max-width: 1180px; width: 100%; min-width: 0; }
.topbar { display: none; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; margin-bottom: 6px; }

/* ---------- Bausteine ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line); gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 13px; color: var(--muted); margin-top: 2px; }
.kpi.bad .value { color: var(--bad); }
a.kpi { color: inherit; display: block; }
a.kpi:hover { text-decoration: none; border-color: var(--line-strong); }
.kpi-mini { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; margin-top: 16px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.bar-fill { width: 100%; max-width: 36px; min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; }
.bar span { font-size: 11px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 32px; padding: 0; height: 32px; }
.btn.block { width: 100%; }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 550; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { resize: vertical; min-height: 64px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 14px; }
.span-1 { grid-column: span 1; } .span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-6 { grid-column: span 6; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.section-title { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr.click { cursor: pointer; }
table.list tbody tr.click:hover { background: var(--surface-2); }
.r { text-align: right; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.strong { font-weight: 600; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty .btn { margin-top: 12px; }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.blue { background: var(--accent-soft); color: var(--accent); }
.badge.green { background: var(--ok-soft); color: var(--ok); }
.badge.red { background: var(--bad-soft); color: var(--bad); }
.badge.amber { background: var(--warn-soft); color: var(--warn); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button { padding: 9px 12px; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 550; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs .active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font: inherit; font-size: 13px; font-weight: 550; color: var(--muted); cursor: pointer; }
.chip.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.search { max-width: 280px; }

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; align-items: center; gap: 10px; padding: 11px 20px; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.list-plain li a.cover { color: inherit; flex: 1; min-width: 0; }
.list-plain .t { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-plain .s { font-size: 13px; color: var(--muted); }

.notice { padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--text); font-size: 14px; }
.notice.warn { background: var(--warn-soft); }
.notice.ok { background: var(--ok-soft); }
.flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.flow .arrow { color: var(--muted); }

/* ---------- Dokument-Editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.editor-side { position: sticky; top: 16px; }
.items { display: flex; flex-direction: column; }
.item { display: grid; grid-template-columns: 28px minmax(0, 1fr) 84px 72px 104px 72px 104px 34px; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: start; }
.item-head { padding-top: 10px; padding-bottom: 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.item .pos { color: var(--muted); padding-top: 8px; font-size: 13px; text-align: right; }
.item .title-in { font-weight: 550; }
.item textarea { margin-top: 6px; min-height: 38px; font-size: 13px; }
.item .total { padding-top: 8px; text-align: right; font-weight: 600; }
.item .tools { display: flex; flex-direction: column; gap: 2px; }
.item input.r { text-align: right; }
.items-actions { display: flex; gap: 8px; padding: 12px 16px; flex-wrap: wrap; }
.sums { width: 100%; font-size: 14px; border-collapse: collapse; }
.sums td { padding: 5px 0; }
.sums .total td { font-weight: 700; font-size: 17px; border-top: 1px solid var(--line); padding-top: 10px; }
.save-state { font-size: 13px; color: var(--muted); }

/* ---------- Dialog & Hinweise ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--text); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
dialog.wide { width: min(780px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(15, 20, 30, .45); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dlg-body { padding: 18px 20px; overflow-y: auto; max-height: calc(100vh - 200px); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.pick { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; max-height: 50vh; overflow-y: auto; margin-top: 12px; }
.pick button { display: flex; gap: 10px; justify-content: space-between; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); padding: 10px 12px; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; }
.pick button:hover { background: var(--surface-2); }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 20px; padding: 12px; background: var(--surface-2); border-radius: 8px; text-align: center; letter-spacing: .05em; user-select: all; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; pointer-events: none; }
.toast { background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); animation: pop .18s ease-out; max-width: calc(100vw - 32px); }
.toast.err { background: var(--bad); color: #fff; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-box { width: 100%; max-width: 400px; }
.auth .logo { justify-content: center; font-size: 22px; padding-bottom: 6px; }
.auth .logo-mark { width: 36px; height: 36px; font-size: 15px; border-radius: 9px; }
.auth .claim { text-align: center; color: var(--muted); margin-bottom: 22px; }
.auth form { display: flex; flex-direction: column; gap: 12px; }
.demo { margin-top: 16px; font-size: 13px; }
.demo button { border: 0; background: none; color: var(--accent); font: inherit; padding: 0; cursor: pointer; }

/* ---------- Dokument-Vorschau & Briefpapier-Auswahl (das Briefpapier selbst: paper.css) ---------- */
.paper-wrap { background: var(--surface-2); border-radius: var(--radius); padding: 24px; overflow-x: auto; }
.designs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.design-opt { border: 2px solid var(--line); border-radius: 12px; background: var(--surface); padding: 8px 8px 10px; cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.design-opt:hover { border-color: var(--line-strong); }
.design-opt.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.design-opt .name { font-weight: 600; font-size: 14px; margin-top: 8px; display: flex; justify-content: space-between; align-items: center; }
.thumb { height: 170px; overflow: hidden; border-radius: 7px; background: var(--surface-2); position: relative; pointer-events: none; }
.thumb .paper { position: absolute; top: 0; left: 50%; transform: translateX(-50%) scale(.26); transform-origin: top center; box-shadow: 0 6px 30px rgba(0, 0, 0, .25); zoom: 1; }
.brand-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.brand-row input[type="color"] { width: 44px; height: 36px; padding: 2px; cursor: pointer; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; padding: 0; }
.swatch.active { box-shadow: 0 0 0 2px var(--accent); }
.letter-preview { max-height: 760px; overflow: auto; }

/* ---------- Druckseite ---------- */
.print-bar { position: sticky; top: 0; display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 2; box-shadow: var(--shadow); }
.print-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.print-title div { display: flex; flex-direction: column; line-height: 1.3; }
.print-title small { color: var(--muted); font-size: 13px; }
.print-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pdf-hint { max-width: 210mm; margin: 16px auto 0; padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); font-size: 14px; }
.print-page { padding: 24px 0; }
@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  .print-bar, .pdf-hint, .toasts { display: none !important; }
  .print-page { padding: 0; }
  .paper { box-shadow: none; margin: 0; width: 210mm; min-height: 297mm; }
}

/* ---------- Dokument-Editor ---------- */
.doc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.doc-title h1 { font-size: 26px; font-weight: 500; letter-spacing: -.01em; }
.doc-title .badge { height: 26px; padding: 0 12px; border: 1px solid var(--line-strong); background: var(--surface); }
.save-state { font-size: 13px; color: var(--muted); }
.doc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-actions .btn { height: 40px; padding: 0 16px; }
.save-btn { min-width: 130px; }
.seg-toggle { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.seg-toggle button { border: 0; background: none; font: inherit; font-size: 14px; font-weight: 550; color: var(--muted); padding: 0 12px; height: 32px; border-radius: 7px; cursor: pointer; }
.seg-toggle button.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.seg-toggle.sm button { height: 28px; font-size: 13px; }
.tb.txt { font-weight: 700; font-size: 17px; color: var(--text); }

.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.doc-main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.dm { display: flex; flex-direction: column; gap: 16px; }
.dm-card { padding: 20px 22px; }
.dm-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; margin-bottom: 20px; }
.dm-h { font-size: 16px; font-weight: 650; margin-bottom: 10px; }
.dm-label { display: flex; flex-direction: column; gap: 6px; font-weight: 650; font-size: 15px; color: var(--text); margin-top: 14px; }
.dm-label input, .dm-label textarea { font-weight: 400; }
.dm-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 0 6px; }
.dm-label-row .dm-label { margin: 0; }
.dm textarea { min-height: 44px; }
.terms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.terms-grid .dm-label:first-child, .terms-grid .dm-label { margin-top: 0; }
.ib { display: flex; flex-direction: column; gap: 6px; }
.ib-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px; }
.ib-label { display: flex; align-items: center; padding: 0 12px; min-height: 38px; background: var(--surface-2); border-radius: 7px; font-size: 14px; font-weight: 550; }
.ib-label small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.ib-val input, .ib-val select { height: 38px; }
.ib-static { display: flex; align-items: center; min-height: 38px; padding: 0 12px; border: 1px dashed var(--line-strong); border-radius: 7px; color: var(--muted); font-size: 14px; }
.cust-card { display: flex; gap: 12px; justify-content: space-between; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.cust-addr { line-height: 1.5; font-size: 14.5px; }
.cust-addr small { display: block; margin-top: 4px; }
.cust-acts { display: flex; flex-direction: column; gap: 6px; }
.combo { position: relative; }
.combo .searchbox { width: 100%; }
.combo-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(15, 20, 30, .15); max-height: 340px; overflow-y: auto; }
.combo-list button, .sug button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; font: inherit; font-size: 14px; color: var(--text); text-align: left; cursor: pointer; }
.combo-list button:hover, .sug button:hover { background: var(--accent-soft); }
.combo-list b, .sug b { display: block; font-weight: 600; }
.combo-list small, .sug small { color: var(--muted); font-size: 12.5px; }
.combo-new { color: var(--accent) !important; font-weight: 600; }
.combo-new svg { width: 16px; height: 16px; }
.sug { position: fixed; z-index: 220; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(15, 20, 30, .18); max-height: 320px; overflow-y: auto; }
.sug-head { padding: 7px 12px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); }

/* Positionstabelle */
.pos-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.pt { border-top: 1px solid var(--line); }
.pt-row { display: grid; grid-template-columns: 20px 24px 70px minmax(160px, 1fr) 60px 56px 84px 64px 50px 90px 30px; gap: 6px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pt-art { font-variant-numeric: tabular-nums; }
.art-no { display: inline-block; min-width: 42px; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; }
.pt-head { font-size: 13px; font-weight: 650; color: var(--text); padding: 12px 0 10px; align-items: end; }
.pt-row input, .pt-row select, .pt-row textarea { padding: 7px 8px; }
.pt-row .r { text-align: right; }
.pt-row [data-total], .pt-row [data-subamt] { padding-top: 8px; }
.pt-handle { padding-top: 8px; color: var(--muted); cursor: grab; opacity: .5; }
.pt-row:hover .pt-handle { opacity: 1; }
.pt-handle svg { width: 18px; height: 18px; }
.pt-pos { padding-top: 8px; color: var(--muted); font-size: 14px; text-align: right; }
.pt-desc input { font-weight: 550; }
.pt-desc2 { grid-column: 4 / 11; font-size: 13px; min-height: 34px; color: var(--muted); }
.pt-desc2:focus { color: var(--text); }
.main.wide-page { max-width: 1680px; }
.pt-span { grid-column: 3 / 11; }
.pt-span-sub { grid-column: 3 / 10; font-weight: 650; }
.k-title .pt-span { font-size: 16px; font-weight: 700; }
.k-sub { background: var(--surface-2); }
.pt-break { border: 1px dashed var(--line-strong); border-radius: 7px; text-align: center; color: var(--muted); font-size: 13px; padding: 7px; }
.pt-row.dragging { opacity: .4; }
.pt-row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.pt-row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.pt-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 0 4px; }
.split { display: inline-flex; }
.split .btn:first-child { border-radius: 8px 0 0 8px; height: 40px; }
.split-arrow { border-radius: 0 8px 8px 0 !important; border-left: 1px solid rgba(255, 255, 255, .35) !important; width: 40px; height: 40px; padding: 0; }
.linkish.accent { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 14px; }
.linkish.accent:hover { text-decoration: underline; }
.pt-discount { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; padding: 8px 0; }
.pt-discount select { width: auto; }
.pt-discount input { width: 110px; text-align: right; }
.pt-sums { max-width: 380px; margin: 10px 0 0 auto; }

/* Seitenleiste: Layout & Vorschau */
.doc-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.side-card { padding: 16px 18px; }
details.side-card summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
details.side-card summary::-webkit-details-marker { display: none; }
details.side-card summary svg { width: 20px; height: 20px; transition: transform .2s; }
details.side-card[open] summary svg { transform: rotate(180deg); }
.side-body { margin-top: 14px; }
.side-card.flash { box-shadow: 0 0 0 3px var(--accent); }
.mini-head { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.mini-head b { display: block; }
.check.sm { font-size: 13px; color: var(--muted); gap: 6px; }
.check.sm input { width: 14px; height: 14px; }
.mini { position: relative; height: 405px; overflow: hidden; border-radius: 6px; cursor: zoom-in; background: var(--surface-2); }
.mini .paper { position: absolute; top: 0; left: 0; transform: scale(.34); transform-origin: top left; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); zoom: 1; }

/* Druckansicht: Bereiche im Briefpapier anklickbar */
.print-tip { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 14px; }
.print-tip svg { width: 18px; height: 18px; color: var(--accent); flex: none; }
.paper.editable [data-zone] { position: relative; cursor: pointer; border-radius: 3mm; outline: 1.5px dashed transparent; outline-offset: 2mm; transition: outline-color .12s, background .12s; }
.paper.editable [data-zone]:hover { outline-color: var(--accent); background: rgba(36, 86, 214, .04); }
.paper.editable [data-zone]:hover::after { content: attr(data-label) "  ✎"; position: absolute; top: -7mm; right: 0; z-index: 3; font: 600 11px/1 var(--font); color: #fff; background: var(--accent); padding: 5px 8px; border-radius: 5px; white-space: nowrap; }
.style-kraeftig.editable .p-head[data-zone]:hover::after { top: auto; bottom: 2mm; right: 18mm; }
dialog.xwide { width: min(1180px, calc(100vw - 32px)); }

/* ---------- Hinweisleiste Testphase ---------- */
.trial-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 32px; background: linear-gradient(90deg, #eef2ff, #f5efff); border-bottom: 1px solid var(--line); font-size: 14px; }
.trial-bar .tb-ic svg { width: 18px; height: 18px; color: #7c4ddf; display: block; }
.trial-bar .tb-meter { width: 110px; height: 6px; border-radius: 99px; background: rgba(124, 77, 223, .15); overflow: hidden; }
.trial-bar .tb-meter i { display: block; height: 100%; background: linear-gradient(90deg, #6b8cff, #7c4ddf); border-radius: 99px; }
.trial-bar .btn { margin-left: auto; }
.trial-bar.warn { background: var(--warn-soft); }
.trial-bar.warn .tb-ic svg { color: var(--warn); }
.trial-bar.bad { background: var(--bad-soft); }
.trial-bar.bad .tb-ic svg { color: var(--bad); }
@media (max-width: 860px) { .trial-bar { padding: 10px 16px; } .trial-bar .tb-meter { display: none; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .trial-bar:not(.warn):not(.bad) { background: linear-gradient(90deg, #1b2140, #231b3b); }
  :root:not([data-theme="light"]) .trial-bar .tb-ic svg { color: #b49cff; }
}
#verify-bar { background: var(--warn-soft); }
#verify-bar .tb-ic svg { color: var(--warn); }

/* ---------- Voll-KI-Angebot ---------- */
.nav a.sub { padding-left: 36px; font-size: 14px; }
.nav a.ai-nav svg { color: #7c4ddf; opacity: 1; }
.nav a.ai-nav { background: linear-gradient(90deg, rgba(124, 77, 223, .1), transparent); }
.nav a.ai-nav.active { background: linear-gradient(90deg, rgba(124, 77, 223, .2), var(--accent-soft)); color: #6d3fd6; }
.kio { max-width: 900px; margin: 0 auto; }
.kio-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.kio-head h1 { font-size: 26px; }
.kio-head p { color: var(--muted); margin: 2px 0 0; }
.kio-head .badge { margin-left: auto; }
.kio-logo { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, #6b8cff, #7c4ddf); color: #fff; box-shadow: 0 10px 26px rgba(124, 77, 223, .35); animation: kio-glow 3s ease-in-out infinite; }
.kio-logo svg { width: 26px; height: 26px; }
@keyframes kio-glow { 50% { box-shadow: 0 10px 34px rgba(124, 77, 223, .6); } }
.kio-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 22px; flex-wrap: wrap; }
.kio-steps li { display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--muted); transition: all .3s; }
.kio-steps li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--surface-2); }
.kio-steps li span svg { width: 12px; height: 12px; stroke-width: 3; }
.kio-steps li.on { border-color: #7c4ddf; color: var(--text); box-shadow: 0 0 0 3px rgba(124, 77, 223, .12); }
.kio-steps li.on span { background: #7c4ddf; color: #fff; }
.kio-steps li.done span { background: var(--ok); color: #fff; }
.kio-chat { display: flex; flex-direction: column; gap: 12px; }
.kio-msg { display: flex; gap: 10px; align-items: flex-end; animation: kio-in .35s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes kio-in { from { opacity: 0; transform: translateY(10px); } }
.kio-msg.me { justify-content: flex-end; }
.kio-av { width: 34px; height: 34px; flex: none; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, #6b8cff, #7c4ddf); color: #fff; }
.kio-av svg { width: 17px; height: 17px; }
.kio-bubble { max-width: 640px; padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.5; }
.bot .kio-bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; box-shadow: var(--shadow); }
.me .kio-bubble { background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.me .linkish { color: inherit; opacity: .8; margin-left: 10px; font-size: 12.5px; }
.kio-bubble small { color: var(--muted); }
.me .kio-bubble small { color: inherit; opacity: .8; }
.kio-typing { display: flex; align-items: center; gap: 5px; }
.kio-typing i { width: 7px; height: 7px; border-radius: 50%; background: #7c4ddf; animation: blink 1s infinite; }
.kio-typing i:nth-child(2) { animation-delay: .15s; } .kio-typing i:nth-child(3) { animation-delay: .3s; }
.kio-typing span { margin-left: 8px; color: var(--muted); font-size: 14px; }
.kio-card { margin-left: 44px; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); animation: kio-in .4s cubic-bezier(.2, .8, .2, 1) both; display: flex; flex-direction: column; gap: 6px; }
.kio-card .dm-label { margin-top: 12px; }
.kio .kio-card .combo-list { position: static; margin-top: 6px; box-shadow: none; max-height: 250px; }
.kio-foot { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.kio-foot .btn { height: 42px; padding: 0 18px; }
.kio-h { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 14px 0 6px; }
.kio-h:first-child { margin-top: 0; }
.kio-h svg { width: 18px; height: 18px; color: #7c4ddf; }
.kio-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kio-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); transition: opacity .2s, background .2s; }
.kio-row:last-child { border-bottom: 0; }
.kio-row b { display: block; font-size: 14px; }
.kio-row small { color: var(--muted); font-size: 12.5px; }
.kio-row input.r { width: 74px; text-align: right; padding: 6px 8px; }
.kio-row .unit { width: 40px; color: var(--muted); font-size: 13px; }
.kio-row .price { width: 84px; text-align: right; font-size: 13px; color: var(--muted); }
.kio-row.mat { cursor: pointer; }
.kio-row.mat.off { opacity: .5; background: var(--surface-2); }
.kio-row input[type="checkbox"] { flex: none; }
.kio-q { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; font-weight: 600; font-size: 14px; }
.kio-ph { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.kio-ph b { display: block; font-size: 16px; }
.kio-table { margin-top: 14px; display: flex; flex-direction: column; }
.kt-title { font-weight: 800; color: #6d3fd6; padding: 12px 0 6px; border-bottom: 1.5px solid rgba(124, 77, 223, .3); }
.kt-text { color: var(--muted); font-size: 13.5px; padding: 10px 0; }
.kt-row { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kt-row b { display: block; }
.kt-row small { color: var(--muted); font-size: 12.5px; }
.kt-row .num { min-width: 78px; text-align: right; }
.kio-sums { max-width: 320px; margin: 14px 0 0 auto; }
.kio-create { height: 46px !important; font-size: 15px; }
@media (max-width: 860px) {
  .kio-card { margin-left: 0; padding: 16px; }
  .kio-row { flex-wrap: wrap; }
  .kio-row .spacer { flex-basis: calc(100% - 80px); }
  .kt-row { flex-wrap: wrap; }
  .kio-head .badge { margin-left: 0; }
}

/* ---------- KI-Grafik ---------- */
.gfx { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.gfx-form { display: flex; flex-direction: column; gap: 10px; }
.gfx-step { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-top: 8px; }
.gfx-step span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; background: var(--accent); color: var(--accent-text); }
.fmt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.fmt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: center; transition: border-color .15s, transform .15s; }
.fmt:hover { transform: translateY(-2px); }
.fmt.active { border-color: var(--accent); background: var(--accent-soft); }
.fmt-shape { height: 46px; max-width: 70px; border-radius: 5px; background: linear-gradient(135deg, var(--accent), #7c4ddf); opacity: .85; }
.fmt b { font-size: 12.5px; line-height: 1.25; }
.fmt small { color: var(--muted); font-size: 11px; }
.drop { position: relative; display: grid; place-items: center; min-height: 110px; border: 2px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); cursor: pointer; text-align: center; padding: 12px; transition: border-color .15s, background .15s; overflow: hidden; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop span { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.drop span svg { width: 24px; height: 24px; color: var(--accent); transform: rotate(180deg); }
.drop small { color: var(--muted); font-size: 12.5px; }
.drop img { max-height: 160px; max-width: 100%; border-radius: 8px; }
.drop #photo-del { position: absolute; top: 6px; right: 6px; background: var(--surface); }
.logo-chip { height: 22px; max-width: 80px; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px 4px; border: 1px solid var(--line); }
.gfx-go { height: 46px; margin-top: 8px; font-size: 15px; }
.gfx-out { position: sticky; top: 16px; }
.gfx-stage { display: grid; place-items: center; min-height: 420px; border-radius: 12px; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 22px 22px; padding: 16px; }
.gfx-img { max-width: 100%; max-height: 640px; border-radius: 8px; box-shadow: 0 16px 40px rgba(15, 20, 30, .25); animation: pop .3s ease-out; }
.gfx-empty, .gfx-wait { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--muted); padding: 20px; }
.gfx-empty svg { width: 36px; height: 36px; color: #a58be6; }
.gfx-empty b, .gfx-wait b { color: var(--text); font-size: 16px; }
.gfx-wait { width: min(100%, 380px); max-height: 560px; justify-content: center; border-radius: 12px; background: linear-gradient(110deg, var(--surface-2) 30%, var(--accent-soft) 50%, var(--surface-2) 70%) 0 0 / 300% 100%; animation: shimmer 1.6s linear infinite; }
.gfx-wait span svg { width: 34px; height: 34px; color: #7c4ddf; animation: spin 2.4s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }
.gfx-actions { margin-top: 12px; }
.gfx-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; padding: 16px; }
.g-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: start; }
.g-thumb { grid-column: 1 / -1; display: grid; place-items: center; height: 150px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; padding: 8px; }
.g-thumb img { max-width: 100%; max-height: 100%; border-radius: 4px; }
.g-thumb:hover { border-color: var(--accent); }
.g-meta { min-width: 0; }
.g-meta b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-meta small { color: var(--muted); font-size: 12px; }
@media (max-width: 1100px) { .gfx { grid-template-columns: 1fr; } .gfx-out { position: static; } }

/* ---------- Marge (intern) ---------- */
.margin-box { display: flex; gap: 18px; flex-wrap: wrap; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 14px; }
.neg { color: var(--bad); }
.pos { color: var(--ok); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 10px 0 6px; }
.meter div { height: 100%; background: var(--ok); border-radius: 99px; }
.margin-card { display: grid; grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(0, 1fr)) auto; gap: 18px; align-items: center; }
.mm { display: flex; flex-direction: column; gap: 2px; }
.mm span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.mm b { font-size: 19px; }
.mm .meter { margin: 6px 0 0; }
@media (max-width: 1100px) { .margin-card { grid-template-columns: 1fr 1fr; } }

/* ---------- Listenkopf (Kunden) ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.list-head h1 { font-size: 26px; font-weight: 500; letter-spacing: -.01em; }
.list-head .count { font-size: 16px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.toolbar { display: flex; gap: 8px; align-items: center; }
.tb { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.tb:hover { color: var(--accent); border-color: var(--line-strong); }
.tb svg { width: 18px; height: 18px; }
.toolbar .btn { height: 40px; padding: 0 16px; }
.list-tools { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.searchbox { display: flex; align-items: center; gap: 8px; width: 340px; max-width: 100%; padding: 0 12px; height: 42px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; }
.searchbox svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.searchbox input { border: 0; padding: 0; outline: 0; background: transparent; }
.searchbox:focus-within { border-color: var(--accent); }
.seg { display: flex; gap: 2px; }
.seg button { border: 0; background: none; font: inherit; font-size: 14px; font-weight: 550; color: var(--muted); padding: 8px 12px; border-bottom: 2px solid transparent; cursor: pointer; }
.seg button span { font-weight: 400; margin-left: 2px; }
.seg button.active { color: var(--accent); border-bottom-color: var(--accent); }
table.grid-list th { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
table.grid-list td { padding-top: 14px; padding-bottom: 14px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover, th.sorted { color: var(--text); }
.sort-ic { margin-left: 4px; color: var(--accent); }
.sigma { font-size: 12px; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; margin-top: 4px; }
td.cb, th.cb { width: 44px; padding-right: 0; }
td.ell { max-width: 240px; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.list tbody tr.selected { background: var(--accent-soft); }
.row-more { opacity: .35; }
tr:hover .row-more, tr.menu-on .row-more { opacity: 1; }
.pager { display: flex; justify-content: center; align-items: center; gap: 20px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.pages { display: flex; align-items: center; gap: 4px; }
.pg { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 6px; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; }
.pg:hover:not(:disabled) { background: var(--surface-2); }
.pg.active { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.pg:disabled { opacity: .35; cursor: default; }

/* ---------- KI-Knöpfe ---------- */
.btn.ai { border-color: #c9b8f5; color: #6d3fd6; background: #f6f2ff; }
.btn.ai:hover { background: #efe8ff; }
.ai-ic { color: #7c4ddf; }
.ai-row { margin-top: -4px; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid #7c4ddf; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.ai { background: #261d3d; border-color: #4b3a7a; color: #c4b0ff; }
}

/* ---------- Hilfe & Support ---------- */
.support-btn { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: auto; margin-bottom: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.support-btn:hover { border-color: var(--accent); }
.support-btn svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.support-btn b { display: block; font-size: 14px; }
.support-btn small { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 5px; }
.side-foot { margin-top: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); margin-right: 4px; vertical-align: 1px; }
.dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.support-panel { position: fixed; left: 244px; bottom: 16px; z-index: 150; width: 380px; height: min(580px, calc(100vh - 32px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 50px rgba(15, 20, 30, .25); overflow: hidden; animation: pop .15s ease-out; }
.sp-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px; border-bottom: 1px solid var(--line); }
.sp-head b { display: block; }
.sp-head small { color: var(--muted); font-size: 12.5px; }
.sp-body { padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.sp-opt { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.sp-opt:hover { border-color: var(--accent); text-decoration: none; }
.sp-opt b { display: block; }
.sp-opt small { color: var(--muted); font-size: 13px; }
.ai-qi { background: #f1eaff; color: #7c4ddf; }
.sp-link { text-align: center; font-size: 13px; margin-top: 6px; }
.sp-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.msg { max-width: 85%; display: flex; flex-direction: column; gap: 2px; }
.msg > div { padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; }
.msg small { font-size: 11px; color: var(--muted); padding: 0 6px; }
.msg.support { align-self: flex-start; }
.msg.support > div { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.me > div { background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.msg.typing { flex-direction: row; gap: 4px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.msg.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1s infinite; }
.msg.typing i:nth-child(2) { animation-delay: .15s; } .msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .25; } }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 0; background: var(--bg); }
.sp-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.sp-input .btn.icon { width: 38px; height: 38px; }
@media (max-width: 860px) {
  .support-panel { left: 8px; right: 8px; bottom: 8px; width: auto; height: calc(100vh - 16px); }
  .searchbox { width: 100%; }
}

/* ---------- Summenleiste & Kontextmenü (Dokumentenlisten) ---------- */
.sumbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; box-shadow: var(--shadow); }
.sum-item { background: var(--surface); padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.sum-item span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sum-item b { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.hint-line { font-size: 13px; margin: 10px 2px 0; }
table.list tbody tr.menu-on { background: var(--accent-soft); }
.ctx { position: fixed; z-index: 200; min-width: 270px; padding: 6px 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 36px rgba(15, 20, 30, .18), 0 2px 6px rgba(15, 20, 30, .08); animation: pop .12s ease-out; }
.ctx-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 9px 18px; border: 0; background: none; font: inherit; font-size: 14.5px; color: var(--text); text-align: left; cursor: pointer; }
.ctx-item svg { width: 19px; height: 19px; color: var(--muted); flex: none; }
.ctx-item:hover, .ctx-item:focus-visible { background: var(--accent-soft); outline: none; }
.ctx-item:hover svg, .ctx-item:focus-visible svg { color: var(--accent); }
.ctx-item.danger, .ctx-item.danger svg { color: var(--bad); }
.ctx-item[aria-disabled] { color: var(--muted); opacity: .5; cursor: default; }
.ctx-item[aria-disabled]:hover { background: none; }
.ctx-sep { height: 1px; background: var(--line); margin: 6px 0; }

/* ---------- Übersicht ---------- */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dash-head h1 { font-size: 26px; margin-top: 2px; letter-spacing: -.01em; }
.dash-head .muted { font-size: 14px; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.quick-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); transition: border-color .15s, transform .15s; }
.quick-item:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.quick-item b { display: block; font-size: 15px; }
.quick-item small { color: var(--muted); font-size: 13px; }
.qi { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.qi svg { width: 20px; height: 20px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; color: var(--text); }
.stat:hover { text-decoration: none; border-color: var(--line-strong); }
.stat-top { display: flex; align-items: center; gap: 10px; }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 550; }
.stat .value { font-size: 25px; font-weight: 700; letter-spacing: -.01em; }
.stat .foot { color: var(--muted); font-size: 13px; }
.chip-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.chip-icon svg { width: 16px; height: 16px; }
.chip-icon.blue { background: var(--accent-soft); color: var(--accent); }
.chip-icon.green { background: var(--ok-soft); color: var(--ok); }
.chip-icon.red { background: var(--bad-soft); color: var(--bad); }
.chip-icon.amber { background: var(--warn-soft); color: var(--warn); }
.chip-icon.gray { background: var(--surface-2); color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
.card-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.chart { position: relative; margin-top: 12px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--line-strong); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .axis.future { opacity: .5; }
.chart .bar { fill: var(--accent); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit.on { fill: var(--text); fill-opacity: .04; }
.chart-empty { position: absolute; inset: 0 0 26px 52px; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.tip { position: absolute; top: 0; min-width: 170px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12); font-size: 13px; pointer-events: none; }
.tip .row { gap: 12px; flex-wrap: nowrap; }
.chart-table { margin-top: 10px; font-size: 13px; }
.chart-table summary { cursor: pointer; color: var(--muted); }
.chart-table table { margin-top: 8px; }
.offer-card { display: flex; flex-direction: column; gap: 14px; }
.quote { display: flex; align-items: center; gap: 14px; }
.quote-num { font-size: 34px; font-weight: 750; letter-spacing: -.02em; }
.list-plain.flush li { padding: 9px 0; }
.list-plain .amt { min-width: 96px; text-align: right; }
.due { display: inline-flex; align-items: center; gap: 3px; }
.due svg { width: 13px; height: 13px; }
.due.bad { color: var(--bad); font-weight: 600; }
.due.warn { color: var(--warn); font-weight: 600; }

/* Checkliste „Erste Schritte“ */
.setup { padding: 18px 20px; margin-bottom: 16px; }
.setup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 12px 0 14px; }
.progress div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.setup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.setup-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); }
.setup-item:hover { text-decoration: none; border-color: var(--accent); }
.setup-item b { display: block; font-size: 14px; font-weight: 600; }
.setup-item small { color: var(--muted); font-size: 12.5px; }
.setup-item .tick { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; margin-top: 1px; }
.setup-item.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.setup-item.done b { text-decoration: line-through; color: var(--muted); }
.tick svg { width: 13px; height: 13px; stroke-width: 3; }

/* So funktioniert's */
.how { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.how-step { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 10px; background: var(--surface-2); }
.how-step b { font-size: 14px; }
.how-step small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.how-num { position: absolute; top: 10px; right: 12px; font-size: 12px; font-weight: 700; color: var(--muted); }
.faq details { border-bottom: 1px solid var(--line); padding: 0 20px; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; padding: 13px 0; font-weight: 550; }
.faq p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

/* ---------- Einrichtungsassistent ---------- */
.wiz { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
.wiz-side { background: var(--surface); border-right: 1px solid var(--line); padding: 24px 18px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.wiz-sub { color: var(--muted); font-size: 13px; margin: -10px 0 24px 48px; }
.wiz-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.wiz-steps li { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--muted); font-weight: 550; }
.wiz-steps li span { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; border: 2px solid var(--line-strong); }
.wiz-steps li span svg { width: 13px; height: 13px; stroke-width: 3; }
.wiz-steps li.active { color: var(--text); background: var(--accent-soft); }
.wiz-steps li.active span { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.wiz-steps li.done span { border-color: var(--ok); background: var(--ok); color: #fff; }
.wiz-note { margin-top: auto; font-size: 13px; color: var(--muted); padding: 10px; }
.wiz-main { padding: 32px 40px 60px; min-width: 0; }
.wiz-top { max-width: 860px; margin: 0 auto 16px; font-size: 13px; }
.wiz-top .progress { margin: 8px 0 0; }
.wiz-card { max-width: 860px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 32px 36px; }
.wiz-card h1 { font-size: 26px; letter-spacing: -.01em; }
.wiz-card .lead { color: var(--muted); font-size: 15.5px; margin: 8px 0 22px; max-width: 640px; }
.wiz-foot { display: flex; gap: 8px; align-items: center; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.wiz-skipall { text-align: center; margin: 14px 0 0; }
.linkish { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.trade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.trade { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 14px 16px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.trade:hover { border-color: var(--line-strong); }
.trade.active { border-color: var(--accent); background: var(--accent-soft); }
.trade small { color: var(--muted); font-size: 13px; }
.wiz-items { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; }
.wiz-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.wiz-item:last-child { border-bottom: 0; }
.wiz-item b { display: block; font-size: 14px; font-weight: 600; }
.wiz-item small { color: var(--muted); font-size: 13px; }
.wiz-done { text-align: center; }
.wiz-done .lead { margin-left: auto; margin-right: auto; }
.done-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: inline-grid; place-items: center; margin-bottom: 14px; }
.done-mark svg { width: 32px; height: 32px; stroke-width: 2.5; }
.logo-prev { min-width: 180px; min-height: 64px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.logo-prev img { max-height: 60px; max-width: 240px; }

/* ---------- Handy & Tablet ---------- */
@media (max-width: 1280px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-side { position: static; }
  .mini-card { display: none; }
}
@media (max-width: 1100px) {
  .dm-top, .terms-grid { grid-template-columns: 1fr; }
  .pt-row { grid-template-columns: 20px 22px 62px minmax(130px, 1fr) 56px 52px 78px 60px 46px 84px 28px; gap: 5px; }
  .dash-grid { grid-template-columns: 1fr; }
  .quick, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .how { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wiz { grid-template-columns: 1fr; }
  .wiz-side { display: none; }
  .editor { grid-template-columns: 1fr; }
  .editor-side { position: static; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15, 20, 30, .4); z-index: 40; }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .topbar .logo { padding: 0; font-size: 16px; }
  .main { padding: 20px 16px 60px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid > * { grid-column: span 2; }
  .form-grid > .span-1 { grid-column: span 1; }
  .item-head { display: none; }
  .item { grid-template-columns: 1fr 1fr 1fr; padding: 14px 16px; }
  .item .pos { display: none; }
  .item .desc-cell { grid-column: 1 / -1; }
  .item .total { grid-column: span 2; text-align: left; }
  .item .tools { flex-direction: row; justify-content: flex-end; }
  .hide-sm { display: none; }
  .paper-wrap { padding: 8px; }
  .paper { zoom: .45; }
  .search { max-width: none; }
}
@media (max-width: 860px) {
  .dm-card { padding: 16px; }
  .ib-row { grid-template-columns: 120px minmax(0, 1fr); }
  .pt-head { display: none; }
  .pt-row { grid-template-columns: 22px repeat(3, minmax(0, 1fr)) 30px; }
  .pt-row.k-item .pt-pos { display: none; }
  .pt-row.k-item .pt-art { grid-column: 2; grid-row: 1; }
  .pt-row.k-item .pt-desc { grid-column: 3 / 5; grid-row: 1; }
  .pt-row.k-item .pt-desc2 { grid-column: 2 / 5; }
  .pt-row.k-item > [data-more] { grid-column: 5; grid-row: 1 / span 3; }
  .pt-row.k-item > .pt-handle { grid-row: 1 / span 3; }
  .pt-span, .pt-span-sub { grid-column: 2 / 5; }
  .k-title > div:nth-child(2), .k-text > div:nth-child(2), .k-break > div:nth-child(2) { display: none; }
  .k-sub .pt-pos { display: none; }
  .pt-span-sub { grid-column: 2 / 4; }
  .doc-actions .btn { padding: 0 12px; }
  .cust-card { flex-direction: column; }
  .cust-acts { flex-direction: row; flex-wrap: wrap; }
  .wiz-main { padding: 16px 16px 40px; }
  .wiz-card { padding: 22px 18px; }
  .designs { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .thumb { height: 110px; }
  .thumb .paper { transform: translateX(-50%) scale(.15); }
}
@media (max-width: 520px) {
  .how { grid-template-columns: 1fr; }
  .stat .value { font-size: 21px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .kpi .value { font-size: 20px; }
  h1 { font-size: 20px; }
}
