:root {
  --wine: #7a1f2b;
  --wine-dark: #5c1520;
  --wine-soft: #f6ecec;
  --cream: #faf6f0;
  --card: #ffffff;
  --ink: #2b2420;
  --muted: #7a6f66;
  --line: #e7ddd2;
  --ok: #3f6b3a;
  --warn-bg: #fff6df;
  --warn: #7a5a00;
  --err-bg: #fdeceb;
  --err: #9b1c1c;
  --radius: 14px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); }
body.embed, body.transparent { background: transparent; }

.ks { max-width: 860px; margin: 0 auto; padding: 20px 16px 28px; }
.ks-head { text-align: center; margin-bottom: 18px; }
.ks-head h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; font-size: 2rem; margin: 0; color: var(--wine); letter-spacing: .01em; }
.ks-sub { margin: 4px 0 0; color: var(--muted); }
body.kompakt .ks-head { display: none; }

.ks-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(60, 30, 20, .04); }
.ks-step { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 600; margin: 0 0 14px; }
.ks-step span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--wine); color: #fff; font-size: .85rem; flex: none; }
.ks-step small { color: var(--muted); font-weight: 400; }
details.ks-card > summary { cursor: pointer; list-style: none; margin: 0; }
details.ks-card > summary::-webkit-details-marker { display: none; }
details.ks-card > summary::after { content: "+"; margin-left: auto; color: var(--wine); font-size: 1.4rem; font-weight: 400; line-height: 1; }
details[open].ks-card > summary { margin-bottom: 14px; }
details[open].ks-card > summary::after { content: "−"; }

.ks-houses { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ks-house { text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font: inherit; color: inherit; transition: border-color .15s, background .15s; }
.ks-house:hover { border-color: #c9a9a9; }
.ks-house.on { border-color: var(--wine); background: var(--wine-soft); box-shadow: inset 0 0 0 1px var(--wine); }
.ks-house-name { font-weight: 700; }
.ks-house-ort { font-size: .82rem; color: var(--muted); }
.ks-house-price { white-space: nowrap; margin-top: 6px; font-weight: 600; color: var(--wine); }
.ks-house-price small { font-weight: 400; color: var(--muted); }

.ks-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.ks-field { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; font-weight: 600; }
.ks-field small { font-weight: 400; color: var(--muted); font-size: .78rem; }
.ks-field input { font: inherit; font-weight: 400; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); width: 100%; min-height: 44px; }
.ks-field input:focus { outline: none; border-color: var(--wine); box-shadow: 0 0 0 3px rgba(122, 31, 43, .12); }
.ks-stepper { display: flex; align-items: stretch; }
.ks-stepper input { text-align: center; border-radius: 0; border-left: 0; border-right: 0; -moz-appearance: textfield; }
.ks-stepper input::-webkit-outer-spin-button, .ks-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.ks-stepper button { width: 44px; flex: none; border: 1.5px solid var(--line); background: var(--cream); font-size: 1.2rem; cursor: pointer; color: var(--wine); }
.ks-stepper button:first-child { border-radius: 10px 0 0 10px; }
.ks-stepper button:last-child { border-radius: 0 10px 10px 0; }
.ks-stepper button:hover { background: var(--wine-soft); }
.ks-nights { margin: 12px 0 0; color: var(--muted); font-size: .9rem; }

.ks-msg { padding: 10px 12px; border-radius: 10px; margin: 0 0 10px; font-size: .9rem; }
.ks-msg.warn { background: var(--warn-bg); color: var(--warn); }
.ks-msg.err { background: var(--err-bg); color: var(--err); }

.ks-total { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; background: linear-gradient(135deg, var(--wine), var(--wine-dark)); color: #fff; border-radius: 12px; padding: 18px 20px; margin-bottom: 14px; }
.ks-total-label { font-size: .85rem; opacity: .85; text-transform: uppercase; letter-spacing: .06em; }
.ks-total-sum { font-family: Georgia, serif; font-size: 2.4rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ks-total-meta { font-size: .88rem; opacity: .9; margin-top: 2px; }
.ks-pay { display: grid; gap: 4px; font-size: .9rem; min-width: 210px; }
.ks-pay div { display: flex; justify-content: space-between; gap: 16px; }
.ks-pay span { opacity: .85; }
.ks-pay b { font-variant-numeric: tabular-nums; }

.ks-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ks-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ks-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 6px; border-bottom: 1.5px solid var(--line); }
.ks-table td { padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ks-table .n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ks-table tr.neg td { color: var(--ok); }
.ks-table tfoot td { border-bottom: 0; }
.ks-table tr.tot td { font-weight: 700; font-size: 1rem; padding-top: 12px; border-top: 1.5px solid var(--ink); }
.ks-table tr.sub td { color: var(--muted); font-size: .82rem; padding-top: 2px; padding-bottom: 2px; }
.ks-fine { font-size: .78rem; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }

.ks-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.ks-btn { font: inherit; font-weight: 600; padding: 11px 18px; border-radius: 999px; border: 1.5px solid var(--wine); background: #fff; color: var(--wine); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.ks-btn:hover { background: var(--wine-soft); }
.ks-btn.primary { background: var(--wine); color: #fff; }
.ks-btn.primary:hover { background: var(--wine-dark); }
.ks-btn.ghost { border-color: var(--line); color: var(--muted); }

@media (max-width: 560px) {
  .ks-head h1 { font-size: 1.6rem; }
  .ks-card { padding: 14px; }
  .ks-houses { grid-template-columns: 1fr 1fr; }
  .ks-total-sum { font-size: 2rem; }
  .ks-pay { min-width: 0; width: 100%; }
  .ks-table .hm { display: none; }
  .ks-table { font-size: .85rem; }
}

@media print {
  html, body { background: #fff; }
  .ks-card { border: 0; box-shadow: none; padding: 0; }
  .ks-card:not(.ks-result), .ks-actions { display: none; }
  .ks-total { background: none; color: var(--ink); border: 1px solid var(--ink); }
}
