:root {
  --brand: #1f5f8b;
  --ink: #1d2733;
  --muted: #5a6573;
  --line: #d9dee5;
  --bg: #f4f6f8;
  --card: #ffffff;
  --ok: #1d7a45;
  --ok-bg: #e5f4ea;
  --warn: #9a5a00;
  --warn-bg: #fdf1dc;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --info-bg: #e8f1f8;
  --pending: #6b4bb3;
  --pending-bg: #efeafb;
  --radius: 10px;
  --focus: 0 0 0 3px #ffbf47;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, .page:focus-visible { outline: none; box-shadow: var(--focus); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2, .h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
code { font-size: .85em; word-break: break-all; background: #eef1f4; padding: 1px 4px; border-radius: 4px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: #fff; padding: .5rem 1rem; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }
.small, small { font-size: .85rem; }
.strong { font-weight: 600; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; color: var(--muted); margin: 0 0 .25rem; font-weight: 600; }

.test-banner { background: #9a5a00 !important; }
.demo-banner { background: #23303d; color: #fff; text-align: center; font-size: .85rem; padding: .35rem 1rem; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1440px; margin: 0 auto; padding: .6rem 1rem; display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.brand-logo { height: 28px; width: auto; max-width: 140px; }
.logo-preview { max-height: 60px; width: auto; align-self: flex-start; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }
.brand-mark { width: 14px; height: 14px; border-radius: 4px; background: var(--brand); display: inline-block; }
.mainnav { display: flex; gap: .25rem; }
.mainnav a { text-decoration: none; color: var(--muted); padding: .35rem .7rem; border-radius: 6px; font-weight: 500; }
.mainnav a[aria-current="page"] { background: var(--info-bg); color: var(--brand); }
.who { margin-left: auto; display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.who-name small { color: var(--muted); }
.role-pill { font-size: .75rem; padding: .15rem .55rem; border-radius: 99px; background: #eef1f4; color: var(--muted); font-weight: 600; }
.guest-pill { background: var(--pending-bg); color: var(--pending); }

.container { max-width: 1200px; width: 100%; margin: 0 auto; padding: 1.25rem 1rem 2rem; flex: 1; }
.container.narrow { max-width: 1440px; }
.viewer-main { max-width: 1440px; width: 100%; margin: 0 auto; padding: 1rem; flex: 1; }
.footer { color: var(--muted); font-size: .8rem; text-align: center; padding: 1rem; border-top: 1px solid var(--line); background: var(--card); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.head-status { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
.head-status .label { font-size: .8rem; color: var(--muted); }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .75rem; }
.section-title { margin: 1.5rem 0 .75rem; }
.stack { display: flex; flex-direction: column; gap: .5rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .75rem; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: .3rem 0; border-bottom: 1px solid #eef1f4; }
.empty { text-align: center; color: var(--muted); }

label { font-weight: 600; font-size: .9rem; }
input, textarea { font: inherit; padding: .55rem .7rem; border: 1px solid #b7c0cb; border-radius: 8px; width: 100%; background: #fff; color: var(--ink); }
textarea { resize: vertical; }
.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 500; }
.check input { width: auto; margin-top: .3rem; }
.code-input { font-size: 1.6rem; letter-spacing: .3em; max-width: 12rem; text-align: center; }

.btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1px solid #b7c0cb; background: #fff; color: var(--ink); padding: .55rem 1rem; border-radius: 8px; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:hover { background: #f1f3f6; }
.btn.small { min-height: 36px; padding: .3rem .7rem; font-size: .88rem; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.approve { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.warn { background: #fff; border: 2px solid var(--warn); color: var(--warn); }
.btn.danger-outline { border-color: var(--danger); color: var(--danger); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-link { font: inherit; background: none; border: none; color: var(--brand); text-decoration: underline; cursor: pointer; padding: .25rem 0; }

.badge { display: inline-block; padding: .15rem .6rem; border-radius: 99px; font-size: .82rem; font-weight: 600; background: #eef1f4; color: var(--muted); }
.badge.big { font-size: .95rem; padding: .3rem .8rem; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--brand); }
.badge.pending { background: var(--pending-bg); color: var(--pending); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: .05rem .45rem; border-radius: 4px; background: #eef1f4; color: var(--muted); vertical-align: middle; }
.tag.demo { background: #23303d; color: #fff; }
.tag-firm { background: var(--info-bg); color: var(--brand); }
.tag-customer { background: var(--pending-bg); color: var(--pending); }
.tag.addendum { background: var(--warn-bg); color: var(--warn); }

.notice { border-radius: 8px; padding: .7rem 1rem; margin-bottom: 1rem; background: var(--info-bg); border-left: 4px solid var(--brand); }
.notice.success { background: var(--ok-bg); border-color: var(--ok); }
.notice.error { background: var(--danger-bg); border-color: var(--danger); }
.notice.warn, .notice.warning { background: var(--warn-bg); border-color: var(--warn); }
.note { background: #f7f8fa; border-radius: 8px; padding: .55rem .8rem; font-size: .92rem; }
.demo-hint { font-size: .85rem; background: #23303d; color: #fff; border-radius: 8px; padding: .5rem .8rem; }
.demo-hint code { background: #3b4a59; color: #fff; }
.internal-note { border-left: 4px solid #8a96a3; }
.demo-card { border: 2px dashed var(--brand); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td { text-align: left; padding: .7rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .82rem; color: var(--muted); font-weight: 600; background: #f9fafb; }
.page-head + .table-wrap .table, .table-wrap > .table { border: 1px solid var(--line); border-radius: var(--radius); }

.version-card.is-current { border-left: 4px solid var(--brand); }
.version-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.thumbs { display: flex; gap: .75rem; flex-wrap: wrap; margin: .75rem 0; }
.thumb { display: flex; flex-direction: column; gap: .25rem; text-decoration: none; color: var(--muted); font-size: .8rem; }
.thumb img { height: 110px; width: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem 1rem; margin: .5rem 0; }
.facts div { min-width: 0; }
.facts dt { font-size: .78rem; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.tech { margin-top: .75rem; font-size: .85rem; color: var(--muted); }
.tech summary { cursor: pointer; }

.timeline { list-style: none; padding: 0; margin: 0 0 1rem; }
.timeline li { padding: .5rem 0 .5rem 1rem; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .9rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline time { display: block; font-size: .8rem; color: var(--muted); }
.timeline.compact li { font-size: .9rem; }

.login-wrap { display: flex; justify-content: center; align-items: flex-start; }
.login-card { max-width: 480px; margin: 2rem auto; }
.resend { margin-top: .5rem; }

/* Entwurfsansicht */
.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 1rem; align-items: start; }
.stage { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; min-width: 0; }
.stage-bar { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.version-switch, .zoom { display: flex; gap: .3rem; flex-wrap: wrap; }
.vchip, .zbtn { font: inherit; font-size: .88rem; padding: .35rem .75rem; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; }
.vchip.active, .zbtn[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.stage-hint { font-size: .88rem; color: var(--muted); margin-bottom: .5rem; }
.pages { overflow: auto; max-height: calc(100vh - 140px); background: #e9edf1; border-radius: 8px; padding: .75rem; }
.page-wrap { margin: 0 0 1.25rem; }
.page-wrap figcaption { font-size: .85rem; color: var(--muted); margin-bottom: .35rem; font-weight: 600; }
.page { position: relative; width: 100%; box-shadow: 0 1px 4px rgba(0,0,0,.15); background: #fff; user-select: none; touch-action: manipulation; }
.pages[data-zoom-level="150"] .page { width: 150%; }
.pages[data-zoom-level="200"] .page { width: 200%; }
.page img { display: block; width: 100%; height: auto; }
.page.can-comment { cursor: crosshair; }
.marker { position: absolute; transform: translate(-50%, -50%); width: 32px; height: 32px; border-radius: 50% 50% 50% 4px; background: var(--brand); color: #fff; font-weight: 700; font-size: .9rem; display: flex; align-items: center; justify-content: center; text-decoration: none; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); z-index: 2; }
.marker.resolved { background: #8a96a3; }
.marker.draft { background: #e8590c; animation: pulse 1.2s ease-in-out infinite; cursor: move; }
.marker.highlight { outline: 3px solid #ffbf47; }
@keyframes pulse { 50% { transform: translate(-50%, -50%) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .marker.draft { animation: none; } }
.disclaimer { font-size: .8rem; color: var(--muted); margin: .6rem 0 0; }

.panel { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; min-width: 0; }
.status-line { margin: .5rem 0; }
.decision-card { border: 2px solid var(--brand); }
.decide { border: 1px solid var(--line); border-radius: 8px; margin-top: .6rem; }
.decide > summary { cursor: pointer; padding: .75rem 1rem; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 48px; }
.decide > summary::after { content: "▾"; color: var(--muted); }
.decide[open] > summary::after { content: "▴"; }
.decide > form, .decide > .notice { margin: 0 1rem 1rem; }
.decide.changes > summary { color: var(--warn); }
.decide.approve > summary { color: var(--ok); }
.confirm-box { background: #f7f8fa; border-radius: 8px; padding: .75rem; }
.confirm-box blockquote, .decision-done blockquote { margin: .5rem 0 0; padding: .5rem .75rem; border-left: 3px solid var(--ok); background: #fff; font-weight: 600; }
.confirm-text { font-size: .88rem; color: var(--muted); font-style: italic; }
.decision-done { border-radius: 8px; padding: .75rem; margin-top: .75rem; }
.decision-done.approved { background: var(--ok-bg); }
.decision-done.changes_requested { background: var(--warn-bg); }
.decision-done.changes_requested blockquote { border-color: var(--warn); }
.decision-done.revoked { background: var(--danger-bg); }
.decide.revoke > summary { color: var(--danger); font-weight: 600; }
.decision-done .decide.revoke { background: #fff; }
.comments-card h2 .count { font-size: .82rem; color: var(--muted); font-weight: 500; }
.comment-form { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.marker-chosen { display: flex; justify-content: space-between; gap: .5rem; align-items: center; background: #fff4e6; border-radius: 6px; padding: .35rem .6rem; font-size: .9rem; }
.comments { list-style: none; padding: 0; margin: 0; }
.comment { border: 1px solid var(--line); border-radius: 8px; padding: .65rem .75rem; margin-bottom: .6rem; }
.comment.resolved { background: #f7f8fa; }
.comment.resolved .comment-body { color: var(--muted); }
.comment.highlight { box-shadow: var(--focus); }
.comment-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .35rem; }
.num { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; font-size: .8rem; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.num.resolved { background: #8a96a3; }
.comment-body { margin: 0 0 .4rem; overflow-wrap: anywhere; }
.replies { list-style: none; margin: .5rem 0; padding: 0 0 0 .75rem; border-left: 2px solid var(--line); font-size: .92rem; }
.replies li { margin-bottom: .4rem; overflow-wrap: anywhere; }
.comment-actions { display: flex; gap: .5rem; align-items: flex-start; flex-wrap: wrap; }
.reply summary { cursor: pointer; color: var(--brand); font-size: .88rem; padding: .4rem 0; }
.reply form { margin-top: .4rem; }
.panel-links { text-align: center; }

.mail summary { cursor: pointer; display: flex; flex-direction: column; }
.mail-body { white-space: pre-wrap; font-family: inherit; background: #f7f8fa; padding: .75rem; border-radius: 8px; overflow-wrap: anywhere; }

.config-line { background: #23303d; color: #fff; padding: .75rem; border-radius: 8px; overflow-x: auto; font-size: .85rem; }
.preview-open { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: .6rem 0; }

/* Kundenbereich und Anfragen */
.contact-row { display: flex; justify-content: space-between; gap: .75rem; align-items: center; flex-wrap: wrap; }
.comment.internal-msg { background: #f7f5ee; border-style: dashed; }

/* Kommentare */
.comment-filter { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .6rem; }
.origin { margin: .2rem 0; color: var(--muted); }
.trail { margin-top: .4rem; font-size: .85rem; }
.trail summary { cursor: pointer; color: var(--muted); padding: .3rem 0; }
.draft-restored { background: #fff4e6; border-radius: 6px; padding: .35rem .6rem; font-size: .88rem; }

/* Verwaltung (BASIS) */
select { font: inherit; padding: .45rem .6rem; border: 1px solid #b7c0cb; border-radius: 8px; background: #fff; color: var(--ink); max-width: 100%; min-height: 40px; }
input[type="checkbox"] { width: auto; }
input[type="color"] { width: 88px; height: 44px; padding: 4px; cursor: pointer; }
.stack > div { display: flex; flex-direction: column; gap: .3rem; }
.stack .helptext { font-size: .85rem; color: var(--muted); }
.errorlist { color: var(--danger); list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.inline-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.actions-cell { display: flex; gap: .4rem; flex-wrap: wrap; }
.form-card { max-width: 640px; }
.customers-layout { grid-template-columns: minmax(0, 1fr) 360px; }
.qr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: .5rem 0; }
.secret { font-size: 1rem; letter-spacing: .05em; }
a.who-name { color: var(--ink); text-decoration: none; }
a.who-name[aria-current="page"] { text-decoration: underline; }

@media (max-width: 1100px) {
  .viewer { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; overflow: visible; }
  .pages { max-height: none; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .container, .viewer-main { padding: .75rem; }
  .stage { padding: .5rem; }
  .pages { padding: .4rem; }
  .head-status { align-items: flex-start; }
  .who { margin-left: 0; }
  .marker { width: 28px; height: 28px; font-size: .8rem; }
  .table th, .table td { padding: .5rem; }
}
@media print {
  .topbar, .demo-banner, .no-print, .footer, .crumbs { display: none; }
  body { background: #fff; }
  .card { border: 1px solid #999; break-inside: avoid; }
  .tech { display: block; }
}
