:root {
  --bg: #f3f2ef; --card: #fff; --ink: #1a1a1a; --muted: #6b6b6b; --line: #e2e0db;
  --accent: #111; --ok: #1f7a4d; --ok-bg: #e8f5ee; --warn: #9a5b00; --warn-bg: #fdf3e2; --err: #b3261e; --err-bg: #fdecea;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.wrap { max-width: 820px; margin: 0 auto; padding: 16px 16px 64px; }
a { color: inherit; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
.muted { color: var(--muted); font-weight: normal; }
code { background: #f0efec; padding: 1px 5px; border-radius: 4px; }

.card { background: var(--card); border-radius: var(--radius); padding: 20px; margin: 0 0 16px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.narrow { max-width: 420px; margin: 10vh auto 0; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.err { background: var(--err-bg); color: var(--err); }
.notice ul { margin: .3rem 0 0; padding-left: 1.2rem; }
.form .notice { padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.brand { font-weight: 700; text-decoration: none; font-size: 1.1rem; }
.topbar nav { display: flex; align-items: center; gap: 16px; }

.btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 999px; padding: 10px 20px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-sm { padding: 7px 14px; font-size: .9rem; }
.btn-big { width: 100%; padding: 14px; font-size: 1.05rem; margin-top: 12px; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.btn-link.danger { color: var(--err); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.del { margin-top: 16px; }

/* Formulare */
label { display: block; margin: 0 0 12px; font-size: .9rem; font-weight: 600; }
input:not([type=radio]):not([type=checkbox]), select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-weight: normal; background: #fff; color: var(--ink); min-height: 44px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: normal; font-size: .95rem; }
label.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg legend { grid-column: 1 / -1; }
.seg label { margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; height: 100%; }
.seg small { display: block; color: var(--muted); font-weight: normal; font-size: .8rem; }
.seg input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }
.rows .row, .row { display: grid; grid-template-columns: 1.1fr 1.3fr 1fr 1fr auto; gap: 8px; align-items: end; }
.row.two { grid-template-columns: 1fr 1fr; margin-top: 12px; }
.row.one { grid-template-columns: 1fr; margin-top: 4px; }
.prices { margin-top: 16px; margin-bottom: 0; }
.prices .row.two { margin-top: 0; }
.doc .roomblock + .roomblock { margin-top: .8rem; }
.row .rm { margin-bottom: 22px; font-size: 1.1rem; text-decoration: none; }
[data-add] { margin: 0 0 8px; }
[hidden] { display: none !important; }

.share { display: flex; gap: 8px; }
.share input { margin: 0 !important; font-size: .85rem !important; }

.sigpad { border: 1.5px dashed #b9b6ae; border-radius: 10px; background: #fcfcfb; margin: 0 0 12px; }
.sigpad canvas { display: block; width: 100%; height: 180px; touch-action: none; cursor: crosshair; }
.sigpad.missing { border-color: var(--err); }
.sigpad.filled { border-style: solid; }
.sigpad-bar { display: flex; justify-content: space-between; padding: 6px 12px; border-top: 1px solid var(--line); font-size: .85rem; }
.saved-sig { display: block; max-width: 260px; max-height: 90px; margin: -4px 0 12px 28px; }

/* Status & Liste */
.status { display: inline-block; font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.s-open { background: #eceae5; color: #555; }
.s-customer_signed { background: var(--warn-bg); color: var(--warn); }
.s-done { background: var(--ok-bg); color: var(--ok); }
.h-sum { font-size: 1.2rem; margin-top: .5rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
.list a { display: flex; align-items: center; gap: 12px; padding: 12px 0; text-decoration: none; }
.li-main { min-width: 0; }
.li-main small { display: block; color: var(--muted); }

/* Vertragsdokument */
.doc { background: #fff; border-radius: var(--radius); padding: 40px 48px; margin: 0 0 16px; box-shadow: 0 1px 2px rgba(0,0,0,.05); font-size: 15px; line-height: 1.55; }
.doc h1 { text-align: center; font-size: 1.6rem; margin-bottom: 1.5rem; }
.doc h2 { font-size: 1rem; margin: 1.6rem 0 .6rem; }
.doc .party { margin-left: 2rem; }
.doc .placeholder { color: var(--muted); font-style: italic; }
.doc .cl { display: flex; gap: 12px; margin: .4rem 0; }
.doc .cl .n { flex: 0 0 2.2rem; }
.doc .room, .doc .bank, .doc .indent { margin-left: 3.4rem; }
.doc .room { margin-top: .6rem; margin-bottom: .6rem; }
.doc .slots-label { margin-top: .4rem; }
.doc table { border-collapse: collapse; }
.doc td { padding: 1px 24px 1px 0; vertical-align: top; }
.doc .sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 3rem; break-inside: avoid; }
.doc .sig img { display: block; height: 80px; max-width: 100%; object-fit: contain; object-position: left bottom; }
.doc .sig-empty { height: 80px; }
.doc .sigline { border-top: 1px dotted #555; margin-bottom: 2px; }
.doc .small { font-size: .85em; color: var(--muted); }
.doc .audit { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .75rem; color: var(--muted); line-height: 1.6; word-break: break-word; break-inside: avoid; }
.mono { font-family: ui-monospace, Menlo, monospace; }

@media (max-width: 600px) {
  .doc { padding: 24px 18px; font-size: 14px; }
  .doc .party { margin-left: 0; }
  .doc .room, .doc .bank, .doc .indent { margin-left: 0; }
  .doc .sigs { grid-template-columns: 1fr; gap: 24px; }
  .seg { grid-template-columns: 1fr; }
  .rows .row { grid-template-columns: 1fr 1fr auto; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
  .rows .row label:nth-child(1) { grid-column: 1 / 2; }
  .rows .row label:nth-child(2) { grid-column: 2 / 4; }
  .row.two { grid-template-columns: 1fr; }
}

@media print {
  @page { size: A4; margin: 18mm 18mm 16mm; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .card, .noprint, .topbar, form { display: none !important; }
  .doc { box-shadow: none; padding: 0; border-radius: 0; font-size: 11pt; }
  .doc h2 { break-after: avoid; }
}

.demo-bar { background: #ffe066; color: #5c4400; text-align: center; font-weight: 700; font-size: .85rem; padding: 8px 16px; }
