/* PAMS – ELK KAMPA Group · monochromes Corporate Design */
:root {
  --ink: #141414;
  --ink-2: #2b2b2a;
  --bg: #f4f3f0;
  --surface: #ffffff;
  --line: #e3e1dc;
  --line-2: #cfccc5;
  --muted: #6b6a66;
  --ok: #1f7a4d;   --ok-bg: #e6f2eb;
  --bad: #b42318;  --bad-bg: #fbeae8;
  --seen: #a5620b; --seen-bg: #fbf0dc;
  --read: #2f5d8a; --read-bg: #e6eef6;
  --sent: #8a8883; --sent-bg: #efeeea;
  --radius: 4px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--ink); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 650; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
code, pre { font-family: ui-monospace, Consolas, monospace; font-size: .85em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.strong { font-weight: 600; }
.text-danger { color: var(--bad); }
.text-ok { color: var(--ok); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.mt { margin-top: 24px; }
.mt-s { margin-top: 18px; }

/* ---------- Kopfzeile ---------- */
.topbar { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1360px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand img { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; letter-spacing: .14em; }
.brand-text small { font-size: .72rem; color: #b9b7b1; letter-spacing: .03em; }
.mainnav { display: flex; gap: 2px; flex: 1; }
.mainnav a { color: #d6d4cf; text-decoration: none; padding: 8px 12px; border-radius: var(--radius); font-size: .92rem; }
.mainnav a:hover { color: #fff; background: #262625; }
.mainnav a.active { color: #fff; box-shadow: inset 0 -2px 0 #fff; border-radius: 0; }
.pill { display: inline-block; background: #fff; color: var(--ink); border-radius: 10px; font-size: .72rem; padding: 0 7px; font-weight: 700; margin-left: 4px; }
.usermenu { display: flex; align-items: center; gap: 16px; font-size: .88rem; }
.usermenu .who { display: flex; flex-direction: column; text-align: right; line-height: 1.2; }
.usermenu .who small { color: #a5a39d; font-size: .74rem; }
.usermenu .logout { color: #d6d4cf; font-size: .85rem; }
.nav-toggle { display: none; background: none; border: 1px solid #555; color: #fff; font-size: 1.1rem; padding: 4px 10px; border-radius: var(--radius); margin-left: auto; cursor: pointer; }

.container { max-width: 1360px; margin: 0 auto; padding: 28px 24px 48px; }
.footer { text-align: center; color: var(--muted); font-size: .78rem; padding: 0 0 28px; }

/* ---------- Layout-Bausteine ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; color: var(--muted); margin: 0 0 6px !important; }
.crumb { margin: 0 0 10px; font-size: .88rem; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--ink); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.card.narrow { max-width: 560px; margin: 60px auto; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { display: inline; }
details.card > summary::after { content: "＋"; float: right; color: var(--muted); }
details.card[open] > summary::after { content: "－"; }
details.card[open] > summary { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.stack > * + * { margin-top: 8px; }
.section { margin: 30px 0 12px; font-size: 1.05rem; }
.section .count { color: var(--muted); font-weight: 400; }
.empty { border: 1px dashed var(--line-2); padding: 28px; text-align: center; color: var(--muted); border-radius: var(--radius); background: rgba(255,255,255,.5); }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--ink); color: #fff; border: 1px solid var(--ink);
  padding: 9px 18px; font: 600 .9rem var(--font); border-radius: var(--radius); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #333; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: #fff; border-color: var(--ink); }
.btn-small { padding: 5px 11px; font-size: .8rem; }
.btn-block { width: 100%; }
.btn-accept { background: var(--ok); border-color: var(--ok); }
.btn-accept:hover { background: #17603c; }
.btn-reject { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn-reject:hover { background: var(--bad-bg); }
.btn-danger-text { color: var(--bad); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }

/* ---------- Formulare ---------- */
.form label, label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 14px; }
input[type=text], input[type=email], input[type=date], input[type=number], input[type=search], select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font: 400 .93rem var(--font); color: var(--ink);
  background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); }
input:focus, select:focus, textarea:focus, .editor-area:focus { outline: 2px solid var(--ink); outline-offset: -1px; }
select[multiple] { padding: 4px; }
textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
.form-row.checks { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
label.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; font-size: .9rem; cursor: pointer; }
label.check input { margin-top: 3px; accent-color: var(--ink); width: 16px; height: 16px; flex: none; }
label.check.big { font-size: 1rem; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--radius); background: #fafaf8; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px 4px; margin: 0 0 14px; }
.fieldset legend { padding: 0 6px; }
.fieldset legend label { margin: 0; font-weight: 600; }
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar input[type=search], .toolbar input[type=email] { width: 320px; margin: 0; }
.toolbar label { margin: 0; }
.code { background: #f4f3f0; padding: 10px; overflow-x: auto; border-radius: var(--radius); font-size: .76rem; line-height: 1.45; }

/* ---------- Meldungen ---------- */
.flash { padding: 11px 15px; border-radius: var(--radius); margin-bottom: 16px; border-left: 4px solid; background: #fff; font-size: .92rem; }
.flash-ok { border-color: var(--ok); background: var(--ok-bg); }
.flash-error { border-color: var(--bad); background: var(--bad-bg); }
.note { border-left: 3px solid var(--ink); background: #fff; padding: 12px 16px; margin-bottom: 16px; }
.warn-text { color: var(--bad); font-size: .8rem; font-weight: 600; }

/* ---------- Tabellen ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600;
  padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fafaf8; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover, .table tbody tr:hover { background: #fafaf7; }
.table-compact td, .table-compact th { padding: 7px 10px; }
.table a { text-decoration: none; }
.table a:hover { text-decoration: underline; }
tr.inactive td { opacity: .55; }
.reason { margin-top: 6px; padding: 6px 9px; background: #f6f5f2; border-radius: var(--radius); font-size: .82rem; max-width: 320px; }
.reason-reject { background: var(--bad-bg); }
.details-cell { max-width: 380px; word-break: break-word; }

/* ---------- Badges & Status ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .74rem; font-weight: 600; background: var(--sent-bg); color: var(--ink-2); white-space: nowrap; }
.st-sent { background: var(--sent-bg); color: #55534f; }
.st-viewed { background: var(--seen-bg); color: var(--seen); }
.st-read { background: var(--read-bg); color: var(--read); }
.st-accepted { background: var(--ok-bg); color: var(--ok); }
.st-rejected { background: var(--bad-bg); color: var(--bad); }
.doc-published { background: var(--ok-bg); color: var(--ok); }
.doc-archived { opacity: .7; }
.role-admin { background: var(--ink); color: #fff; }
.role-management { background: var(--read-bg); color: var(--read); }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 24px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--ink); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; }
.kpi-val { font-size: 2rem; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-lbl { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.kpi-danger { border-top-color: var(--bad); }
.kpi-danger .kpi-val { color: var(--bad); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-2); margin-bottom: 16px; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; margin-bottom: -1px; border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--ink); }

.bar { display: flex; height: 8px; background: var(--sent-bg); border-radius: 4px; overflow: hidden; margin: 4px 0 4px; }
.bar span { display: block; height: 100%; }
.b-accepted { background: var(--ok); }
.b-rejected { background: var(--bad); }
.b-seen { background: #e3a94a; }
.b-none { background: var(--sent-bg); border: 1px solid var(--line-2); }
.legend { margin-top: 10px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.legend .lg { display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: -8px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chip { border: 1px solid var(--line-2); background: #fff; border-radius: 20px; padding: 6px 14px; font: 500 .85rem var(--font); cursor: pointer; color: var(--ink); }
.chip b { margin-left: 4px; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip-ok b { color: var(--ok); } .chip-danger b { color: var(--bad); }
.chip.active b { color: #fff; }
.chips .search { width: 280px; margin: 0 0 0 auto; }

details.menu { position: relative; display: inline-block; }
details.menu summary { list-style: none; cursor: pointer; padding: 2px 10px; border-radius: var(--radius); font-size: 1.1rem; line-height: 1; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu summary:hover { background: var(--bg); }
details.menu > div { position: absolute; right: 0; top: 100%; z-index: 5; background: #fff; border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.1); min-width: 220px; padding: 4px; }
details.menu form { margin: 0; }
details.menu button { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; font: .86rem var(--font); cursor: pointer; border-radius: 3px; }
details.menu button:hover { background: var(--bg); }

/* ---------- Meine Dokumente ---------- */
.doc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.doc-card { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ink); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.doc-card:hover { border-color: var(--ink); }
.doc-card.overdue { border-left-color: var(--bad); }
.doc-card-title { font-weight: 650; font-size: 1.05rem; }
.doc-card-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .85rem; margin-top: 6px; }

/* ---------- Leseseite ---------- */
.steps { display: flex; list-style: none; padding: 0; margin: 0 0 18px; gap: 0; counter-reset: s; }
.steps li { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: .88rem; font-weight: 600; }
.steps li + li { border-left: 0; }
.steps li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid currentColor; font-size: .78rem; flex: none; }
.steps li.current { color: var(--ink); box-shadow: inset 0 -3px 0 var(--ink); }
.steps li.done { color: var(--ok); }
.steps li.done span { background: var(--ok); border-color: var(--ok); color: #fff; font-size: 0; }
.steps li.done span::after { content: "✓"; font-size: .8rem; }
.document { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 40px 48px; margin-bottom: 18px; }
.doc-body { max-width: 780px; font-size: 1rem; line-height: 1.7; }
.doc-body h1, .doc-body h2 { margin-top: 1.4em; }
.doc-body h3 { margin-top: 1.2em; }
.doc-body table { border-collapse: collapse; }
.doc-body td, .doc-body th { border: 1px solid var(--line-2); padding: 6px 10px; }
.doc-pdf { margin-top: 20px; border: 1px solid var(--line); }
.doc-pdf-head { display: flex; justify-content: space-between; padding: 10px 14px; background: #fafaf8; border-bottom: 1px solid var(--line); font-size: .88rem; }
.doc-pdf iframe { width: 100%; height: 78vh; border: 0; display: block; }
.doc-end { text-align: center; color: var(--muted); font-size: .8rem; letter-spacing: .1em; margin-top: 32px; }
.action-panel { position: sticky; bottom: 0; background: #fff; border: 1px solid var(--ink); border-radius: var(--radius); padding: 18px 22px; box-shadow: 0 -6px 24px rgba(0,0,0,.08); }
.action-panel label.check.big { margin-bottom: 10px; }
.result { padding: 22px 26px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--ink); }
.result-accepted { border-left-color: var(--ok); }
.result-accepted h2 { color: var(--ok); }
.result-rejected { border-left-color: var(--bad); }
.result-rejected h2 { color: var(--bad); }
.result code { word-break: break-all; }

/* ---------- Editor ---------- */
.editor { border: 1px solid var(--line-2); border-radius: var(--radius); margin: 5px 0 8px; background: #fff; }
.editor-bar { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: #fafaf8; flex-wrap: wrap; position: sticky; top: 66px; z-index: 2; }
.editor-bar button { background: none; border: 1px solid transparent; padding: 4px 9px; border-radius: 3px; cursor: pointer; font: .85rem var(--font); color: var(--ink); }
.editor-bar button:hover, .editor-bar button.on { border-color: var(--line-2); background: #fff; }
.editor-bar .sep { width: 1px; background: var(--line-2); margin: 3px 4px; }
.editor-area { min-height: 380px; padding: 18px 22px; max-width: none; }
.editor-area:empty::before { content: "Text der Vereinbarung hier erfassen oder aus Word einfügen …"; color: var(--muted); }
.editor-source { width: 100%; min-height: 380px; border: 0; padding: 14px; font: .82rem ui-monospace, Consolas, monospace; margin: 0; }

/* ---------- Picker ---------- */
.picker { border: 1px solid var(--line); border-radius: var(--radius); }
.picker-bar { display: flex; gap: 10px; align-items: center; padding: 10px; border-bottom: 1px solid var(--line); background: #fafaf8; flex-wrap: wrap; }
.picker-bar input { flex: 1; min-width: 220px; margin: 0; }
.picker-list { max-height: 420px; overflow: auto; }
.picker-list th { position: sticky; top: 0; }
.picker tr.sel { background: #f3f7f4; }
.picker tr.via-list td:first-child::after { content: "Liste"; font-size: .65rem; color: var(--ok); display: block; }
.list-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.list-chip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line-2); padding: 6px 12px; border-radius: 20px; font-weight: 500; margin: 0; cursor: pointer; background: #fff; }
.list-chip:has(input:checked) { border-color: var(--ink); background: var(--ink); color: #fff; }
.list-chip:has(input:checked) .muted { color: #ccc; }
.step-h { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.step-h span { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: .82rem; }
.send-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; background: var(--ink); color: #fff; border-radius: var(--radius); }
.send-bar .btn { background: #fff; color: var(--ink); }

/* ---------- Login ---------- */
body.bare { background: var(--ink); }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-brand { color: #fff; padding: 9vh 7vw; display: flex; flex-direction: column; justify-content: center; }
.login-brand h1 { font-size: 2.4rem; font-weight: 600; margin: 40px 0 16px; letter-spacing: -.02em; }
.login-brand p { color: #b9b7b1; max-width: 440px; font-size: 1.05rem; }
.login-form { background: var(--bg); padding: 9vh 6vw; display: flex; flex-direction: column; justify-content: center; }
.login-form > * { max-width: 420px; width: 100%; }
.login-form h2 { font-size: 1.5rem; margin-bottom: 22px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 22px 0 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.sso-buttons { display: flex; flex-direction: column; gap: 8px; }
.sso-buttons .btn { justify-content: space-between; font-weight: 500; }
.sso-buttons small { color: var(--muted); font-weight: 400; }
.devlogin { margin-top: 30px; padding-top: 16px; border-top: 1px dashed var(--line-2); display: flex; flex-wrap: wrap; gap: 8px; }
.devlogin p { width: 100%; margin: 0; }
.devlogin input { flex: 1; margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .grid-main, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 10px 16px; }
  .nav-toggle { display: block; }
  .mainnav, .usermenu { display: none; width: 100%; }
  body.nav-open .mainnav { display: flex; flex-direction: column; }
  body.nav-open .usermenu { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid #333; }
  .usermenu .who { text-align: left; }
  .container { padding: 20px 16px 40px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .document { padding: 24px 18px; }
  .steps { flex-direction: column; }
  .steps li + li { border-left: 1px solid var(--line); border-top: 0; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { padding: 40px 24px 30px; }
  .login-brand img { width: 80px; height: 80px; }
  .login-brand h1 { font-size: 1.7rem; margin-top: 24px; }
  .login-form { padding: 32px 24px; }
  .chips .search, .toolbar input[type=search] { width: 100%; margin: 0; }
  h1 { font-size: 1.45rem; }
}

/* ---------- Felder & Unterschriften ---------- */
.doc-body .center { text-align: center; }
.doc-body .right { text-align: right; }
.fld { background: #fff8d6; border-bottom: 1.5px solid #c9a227; padding: 0 4px; border-radius: 2px; font-weight: 600; }
.fld-empty { background: #fdecea; border-bottom-color: var(--bad); color: var(--bad); font-weight: 500; font-style: italic; }
.fld-pending { background: #eef1f6; border-bottom: 1.5px dashed #8a94a6; color: #4a5568; }
.sig { display: inline-flex; flex-direction: column; min-width: 240px; max-width: 320px; vertical-align: bottom; }
.sig img { height: 80px; width: auto; max-width: 300px; object-fit: contain; object-position: left bottom; }
.sig-placeholder { height: 80px; display: flex; align-items: flex-end; padding: 0 6px 6px; color: #8a94a6; font-size: .82rem; font-style: italic; background: repeating-linear-gradient(-45deg, #f6f7fa, #f6f7fa 8px, #fff 8px, #fff 16px); }
.sig-blank { height: 80px; display: block; }
.sig-line { border-top: 1.5px solid var(--ink); margin-top: 2px; }
.sig-name { font-size: .88rem; padding-top: 4px; }
.sig-label { font-size: .8rem; color: var(--muted); }
table.sig-block { width: 100%; border-collapse: collapse; margin: 2.2em 0 .5em; }
.doc-body table.sig-block td { border: 0; padding: 10px 24px 0 0; vertical-align: top; width: 50%; }
.doc-body table.sig-block td.sig-date { padding-bottom: 28px; }
.sigpad { border: 1px solid var(--line-2); border-radius: var(--radius); background: #fff; margin: 5px 0 14px; position: relative; }
.sigpad canvas { display: block; width: 100%; height: auto; aspect-ratio: 560 / 180; touch-action: none; cursor: crosshair;
  background: linear-gradient(transparent calc(100% - 38px), var(--line-2) calc(100% - 38px), var(--line-2) calc(100% - 37px), transparent calc(100% - 37px)); }
.sigpad-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; border-top: 1px solid var(--line); background: #fafaf8; }
.sigpad.has-sig { border-color: var(--ok); }
.sigpad.shake { animation: shake .5s; border-color: var(--bad); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.decision-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.decision-grid:has(> div:only-child) { grid-template-columns: 1fr; }
.decision-panel { position: static; }
.field-insert { width: auto; max-width: 230px; display: inline-block; margin: 0; padding: 3px 6px; font-size: .82rem; }
.field-help { margin-top: 6px; }
.field-help summary { cursor: pointer; color: var(--muted); }

/* ---------- Vorschau ---------- */
.preview-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: #fff8d6; border: 1px solid #e5cf73; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: .9rem; }
.preview-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.preview-form label { margin: 0; font-size: .78rem; }
.preview-form select { margin-top: 2px; padding: 5px 8px; width: auto; min-width: 180px; }

/* ---------- Druckfassung ---------- */
body.print-page { background: #e9e8e4; }
.print-toolbar { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 10px 24px; background: var(--ink); color: #fff; }
.print-toolbar .btn { background: #fff; color: var(--ink); }
.sheet { max-width: 210mm; min-height: 297mm; margin: 24px auto; background: #fff; padding: 18mm 20mm; box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.sheet .doc-body { max-width: none; font-size: 10.5pt; line-height: 1.55; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 18px; }
.audit-trail { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--line-2); font-size: 8.5pt; break-inside: avoid; }
.audit-trail h3 { font-size: 9.5pt; text-transform: uppercase; letter-spacing: .08em; }
.audit-trail table { width: 100%; border-collapse: collapse; }
.audit-trail th { text-align: left; width: 32%; padding: 3px 8px 3px 0; color: var(--muted); font-weight: 600; vertical-align: top; }
.audit-trail td { padding: 3px 0; overflow-wrap: anywhere; }
.audit-trail code { word-break: break-all; }
@media print {
  @page { size: A4; margin: 0; }
  .no-print { display: none !important; }
  body.print-page { background: #fff; }
  .sheet { margin: 0; box-shadow: none; max-width: none; min-height: 0; }
  .fld, .fld-pending { background: none; border-bottom: 0; padding: 0; font-weight: 600; color: inherit; }
}
@media (max-width: 860px) {
  .decision-grid { grid-template-columns: 1fr; }
  .sheet { padding: 20px; margin: 0; min-height: 0; }
  table.sig-block td { display: block; width: 100%; }
}

/* ---------- Firmenunterschrift ---------- */
.sign-status { padding: 10px 12px; border-radius: var(--radius); font-size: .88rem; margin-bottom: 10px; }
.sign-status.ok { background: var(--ok-bg); color: var(--ok); }
.sign-status.ok img { display: block; max-width: 100%; height: 60px; object-fit: contain; object-position: left; margin-top: 6px; }
.sign-status.wait { background: var(--seen-bg); color: var(--seen); }
.sign-status.bad { background: var(--bad-bg); color: var(--bad); }
.sign-card.sign-open, .sign-card.sign-pending { border-left: 3px solid #e3a94a; }
.sign-card.sign-signed { border-left: 3px solid var(--ok); }
.sign-card .btn + .btn { margin-left: 4px; }
.doc-card.company { border-left-color: #e3a94a; }
.document.tpl .fld-empty, .note .fld-empty { background: #eef1f6; border-bottom: 1.5px dashed #8a94a6; color: #4a5568; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
