:root {
  --teal: #0b778d;
  --teal-deep: #07596a;
  --teal-soft: #e8f3f5;
  --ink: #17272e;
  --muted: #687a82;
  --line: #d9e4e7;
  --paper: #ffffff;
  --canvas: #e9f0f2;
  --page-w: 794px;
  --page-h: 1123px;
  --shadow: 0 24px 70px rgba(20, 48, 58, .16);
}

* { box-sizing: border-box; }

html,
body { margin: 0; min-height: 100%; }

body {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(126, 183, 195, .28), transparent 34rem),
    linear-gradient(145deg, #f2f6f7 0%, var(--canvas) 55%, #f8fafb 100%);
}

button,
input,
textarea,
select { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.app { min-height: 100vh; padding: 30px 24px 56px; }

.panel,
.settings {
  width: min(1120px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.panel {
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 22px;
  background: linear-gradient(120deg, var(--teal-deep), var(--teal) 65%, #15869a);
  color: #fff;
  box-shadow: 0 20px 55px rgba(7, 89, 106, .22);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.panel::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: 19%;
  top: -190px;
  border: 42px solid rgba(255, 255, 255, .055);
  border-radius: 50%;
  pointer-events: none;
}

.panel-intro,
.panel-actions,
.export-status,
.floorplan-toggle { display: flex; align-items: center; }

.panel-intro { gap: 15px; min-width: 0; position: relative; z-index: 1; }

.brand-mark {
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .58);
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .06);
}

.brand-mark span {
  font-size: 22px;
  font-weight: 850;
  letter-spacing: -.06em;
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, .72);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.panel h1 {
  margin: 0 0 4px;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: -.025em;
}

.panel p {
  margin: 0;
  color: rgba(255, 255, 255, .76);
  font-size: 13px;
}

.panel-actions { position: relative; z-index: 1; gap: 17px; flex: 0 0 auto; }

.export-status { gap: 9px; }

.export-status > span:last-child { display: grid; gap: 2px; }
.export-status strong { color: #fff; font-size: 12px; line-height: 1.1; }
.export-status small { color: rgba(255, 255, 255, .66); font-size: 10px; }

.status-dot {
  width: 9px;
  height: 9px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-radius: 50%;
  background: #9ce2bc;
  box-shadow: 0 0 0 4px rgba(156, 226, 188, .12);
}

.primary-action {
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  padding: 0 16px 0 18px;
  background: #fff;
  color: var(--teal-deep);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 39, 48, .2);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.primary-action span:last-child {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--teal);
  font-size: 15px;
}

.primary-action:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(0, 39, 48, .24); }
.primary-action:focus-visible { outline: 3px solid rgba(255, 255, 255, .45); outline-offset: 3px; }
.primary-action:disabled { opacity: .65; cursor: wait; transform: none; }

.settings {
  margin-bottom: 28px;
  display: grid;
  grid-template-columns: 1.32fr 1fr .76fr;
  gap: 14px;
}

.settings-card {
  min-width: 0;
  margin: 0;
  border: 1px solid rgba(11, 119, 141, .13);
  border-radius: 18px;
  padding: 13px 16px 16px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 12px 34px rgba(25, 53, 62, .075);
}

.settings-card legend {
  padding: 0 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
}

.settings-card legend span {
  margin-right: 4px;
  color: var(--teal);
  font-size: 10px;
  letter-spacing: .08em;
}

.settings-card > p {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 11px;
}

.usage-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.usage-options label,
.contact-choice label {
  min-width: 0;
  min-height: 28px;
  padding: 5px 7px;
  border: 1px solid #e2eaec;
  border-radius: 8px;
  background: #f8fafb;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #3a5058;
  font-size: 10px;
  font-weight: 750;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.usage-options label:has(input:checked),
.contact-choice label:has(input:checked) {
  border-color: #9bc4cd;
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.usage-options input,
.contact-choice input,
.floorplan-toggle input { accent-color: var(--teal); }

.usage-options input,
.contact-choice input { width: 13px; height: 13px; margin: 0; }

.contact-choice {
  margin-bottom: 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.contact-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.contact-fields label {
  color: #50626a;
  font-size: 10px;
  font-weight: 750;
}

.contact-fields input {
  width: 100%;
  height: 34px;
  margin-top: 4px;
  border: 1px solid #d7e2e5;
  border-radius: 9px;
  padding: 7px 9px;
  color: #18262c;
  background: #fff;
  outline: none;
  font-size: 11px;
  font-weight: 650;
}

.contact-fields input:focus { border-color: #7db3bf; box-shadow: 0 0 0 3px rgba(11, 119, 141, .08); }

.floorplan-toggle {
  height: calc(100% - 8px);
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid #e2eaec;
  border-radius: 11px;
  background: #f8fafb;
  cursor: pointer;
}

.floorplan-toggle input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; }
.floorplan-toggle span { display: grid; gap: 3px; }
.floorplan-toggle strong { color: var(--ink); font-size: 11px; }
.floorplan-toggle small { color: var(--muted); font-size: 9px; line-height: 1.35; }

.is-hidden { display: none !important; }

.document {
  display: flex;
  flex-direction: column;
  gap: 30px;
  align-items: center;
}

.page {
  position: relative;
  overflow: hidden;
  width: var(--page-w);
  height: var(--page-h);
  min-width: var(--page-w);
  min-height: var(--page-h);
  max-width: var(--page-w);
  max-height: var(--page-h);
  background: #f6f9fa;
  box-shadow: var(--shadow);
}

.pdf-header {
  position: absolute;
  inset: 0 0 auto 0;
  height: 102px;
  overflow: hidden;
  background: var(--teal);
  z-index: 5;
}

.pdf-header img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
}

.pdf-header > span {
  position: absolute;
  right: 34px;
  top: 50%;
  transform: translateY(-50%);
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px;
  color: rgba(255, 255, 255, .86);
  background: rgba(0, 62, 75, .16);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.pdf-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 58px;
  padding: 0 28px;
  background: linear-gradient(90deg, var(--teal-deep), var(--teal));
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  z-index: 20;
}

.contact-line { color: rgba(255, 255, 255, .78); font-weight: 650; }
.contact-line strong { color: #fff; font-weight: 850; }

.hero {
  position: absolute;
  left: 0;
  right: 0;
  top: 102px;
  height: 288px;
  overflow: hidden;
  border: 0;
  z-index: 4;
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 118px;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(246, 249, 250, 0) 0%,
    rgba(246, 249, 250, .12) 28%,
    rgba(246, 249, 250, .78) 78%,
    #f6f9fa 100%
  );
}

.dropzone {
  position: relative;
  border: 1.5px dashed #a8c4ca;
  background:
    linear-gradient(135deg, rgba(230, 241, 244, .8), rgba(255, 255, 255, .95)),
    #f5f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.dropzone.drag {
  border-color: var(--teal);
  background: #e1f1f4;
  transform: scale(.997);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 3;
}

.dropzone img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}

.dropzone.has-image { border: 0; background: #dfe7e9; }
.dropzone.has-image img { display: block; }
.dropzone.has-image .placeholder { display: none; }

.placeholder { position: relative; z-index: 1; padding: 18px; text-align: center; color: #6c838b; }

.placeholder::before {
  content: "+";
  width: 31px;
  height: 31px;
  margin: 0 auto 8px;
  border: 1px solid #bad0d5;
  border-radius: 50%;
  background: rgba(255, 255, 255, .72);
  display: grid;
  place-items: center;
  color: var(--teal);
  font-size: 19px;
  font-weight: 500;
}

.placeholder strong {
  display: block;
  margin-bottom: 4px;
  color: var(--teal-deep);
  font-size: 15px;
}

.placeholder span { font-size: 10px; }

.image-remove {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 6;
  width: 29px;
  height: 29px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 50%;
  padding: 0 0 2px;
  display: none;
  place-items: center;
  color: #fff;
  background: rgba(15, 34, 41, .7);
  box-shadow: 0 5px 14px rgba(0, 0, 0, .22);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.dropzone.has-image .image-remove { display: grid; }
.image-remove:hover { background: rgba(15, 34, 41, .9); }
.image-remove:focus-visible { outline: 3px solid rgba(255, 255, 255, .8); outline-offset: 2px; }

.page1-body {
  position: absolute;
  left: 34px;
  right: 34px;
  top: 350px;
  bottom: 78px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  z-index: 6;
}

.card {
  position: relative;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(199, 216, 221, .88);
  border-radius: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, .985);
  box-shadow:
    0 18px 38px rgba(19, 57, 68, .115),
    0 2px 8px rgba(19, 57, 68, .05);
}

.card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--teal), #65a9b7 55%, transparent);
}

.card::after {
  content: attr(data-section);
  position: absolute;
  right: 18px;
  top: 18px;
  color: #b6c9ce;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .08em;
}

.card h2,
.gallery-title {
  margin: 0;
  color: var(--teal-deep);
  font-size: 22px;
  line-height: 1;
  letter-spacing: -.035em;
}

.card h2 { margin-bottom: 15px; }

.card h3 {
  margin: 14px 0 9px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--teal-deep);
  font-size: 13px;
  line-height: 1;
}

.card label {
  display: block;
  margin-bottom: 9px;
  color: #51656d;
  font-size: 10px;
  font-weight: 780;
  line-height: 1.15;
}

.field-grid { display: grid; gap: 10px; }
.field-grid.two { grid-template-columns: 1fr 1fr; }
.field-grid > label { min-width: 0; }

.card input,
.card textarea,
.card select,
.calculated-output,
.export-value {
  display: block;
  width: 100%;
  height: 34px;
  margin-top: 4px;
  border: 1px solid #d5e0e3;
  border-radius: 8px;
  padding: 7px 9px;
  color: #18262c;
  background: #fbfcfc;
  outline: none;
  overflow: visible;
  font: 650 11px/18px Inter, "Segoe UI", Arial, sans-serif;
}

.card textarea {
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  resize: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card input:focus,
.card textarea:focus,
.card select:focus {
  border-color: #75adba;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 119, 141, .07);
}

.control-frame {
  width: 100%;
  height: 34px;
  margin-top: 4px;
  overflow: hidden;
  border: 1px solid #d5e0e3;
  border-radius: 8px;
  background: #fbfcfc;
  display: flex;
}

.control-frame:focus-within {
  border-color: #75adba;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(11, 119, 141, .07);
}

.control-frame .unit {
  flex: 0 0 34px;
  border-right: 1px solid #d5e0e3;
  color: var(--teal-deep);
  background: var(--teal-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 850;
}

.control-frame input,
.control-frame .calculated-output,
.control-frame .export-value {
  height: 32px;
  min-height: 32px;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.calculated-frame,
.calculated-output { background: var(--teal-soft); }
.calculated-output { color: var(--teal-deep); font-weight: 850; }

.checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 9px;
}

.checks label {
  min-height: 32px;
  margin: 0;
  padding-left: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
  display: grid;
  grid-template-columns: 1fr 64px;
  align-items: center;
}

.checks select {
  height: 30px;
  margin: 0;
  border-width: 0 0 0 1px;
  border-radius: 0;
  padding: 5px 2px 5px 5px;
  background: #fff;
  font-size: 9px;
}

.usage-summary h3 { margin-top: 13px; }

.usage-empty {
  margin: 0;
  color: #829198;
  font-size: 10px;
  font-style: italic;
}

.usage-output {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 7px;
}

.usage-output span {
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid #cfe0e4;
  border-radius: 7px;
  color: #26515d;
  background: #eef6f7;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
}

.usage-summary:not(.is-empty) .usage-empty { display: none; }

.gallery-content,
.floorplan-content {
  position: absolute;
  left: 38px;
  right: 38px;
  top: 132px;
  bottom: 80px;
}

.gallery-heading {
  height: 56px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.gallery-kicker {
  display: block;
  margin-bottom: 5px;
  color: #7f969e;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.gallery-counter {
  min-width: 50px;
  padding: 7px 9px;
  border: 1px solid #d6e4e7;
  border-radius: 999px;
  color: var(--teal-deep);
  background: #fff;
  font-size: 9px;
  font-weight: 850;
  text-align: center;
}

.gallery {
  height: 845px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(3, 1fr);
  gap: 14px;
}

.small {
  min-height: 0;
  overflow: hidden;
  border-radius: 12px;
}

.small .placeholder strong { font-size: 13px; }

.floorplan-content .gallery-title { margin-bottom: 18px; }

.floorplan {
  width: 100%;
  height: 844px;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
}

.floorplan img { object-fit: contain; padding: 14px; background: #fff; }

/* In der PDF werden ausschließlich tatsächlich hochgeladene Zusatzbilder angeordnet. */
.export-page .gallery { align-content: start; }
.export-page .gallery[data-image-count="1"] { grid-template-columns: 1fr; grid-template-rows: 478px; }
.export-page .gallery[data-image-count="2"] { grid-template-columns: 1fr; grid-template-rows: repeat(2, 399px); }
.export-page .gallery[data-image-count="3"] { grid-template-columns: 1fr 1fr; grid-template-rows: 405px 350px; }
.export-page .gallery[data-image-count="3"] .small:first-child { grid-column: 1 / -1; }
.export-page .gallery[data-image-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(2, 365px); }
.export-page .gallery[data-image-count="5"] { grid-template-columns: 1fr 1fr; grid-template-rows: 286px 257px 257px; }
.export-page .gallery[data-image-count="5"] .small:first-child { grid-column: 1 / -1; }
.export-page .gallery[data-image-count="6"] { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 272px); }

@media (max-width: 980px) {
  .settings { grid-template-columns: 1fr 1fr; }
  .optional-settings { grid-column: 1 / -1; }
  .floorplan-toggle { height: auto; }
}

@media (max-width: 850px) {
  .app { padding: 12px 10px 36px; }
  .panel { border-radius: 17px; padding: 18px; flex-direction: column; align-items: stretch; gap: 18px; }
  .panel-actions { justify-content: space-between; }
  .settings { grid-template-columns: 1fr; }
  .optional-settings { grid-column: auto; }
  .document { width: 100%; overflow: hidden; gap: 16px; }
  .page {
    transform: scale(calc((100vw - 20px) / 794));
    transform-origin: top center;
    margin-bottom: calc(-1123px * (1 - ((100vw - 20px) / 794)));
  }
}

@media (max-width: 560px) {
  .panel-intro { align-items: flex-start; }
  .brand-mark { width: 42px; height: 42px; flex-basis: 42px; }
  .panel h1 { font-size: 22px; }
  .panel p { font-size: 11px; line-height: 1.45; }
  .panel-actions { align-items: stretch; flex-direction: column; }
  .primary-action { justify-content: space-between; }
  .usage-options { grid-template-columns: 1fr 1fr; }
  .contact-choice,
  .contact-fields { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .app { padding: 0; }
  .document { gap: 0; }
  .page {
    box-shadow: none;
    break-after: page;
    page-break-after: always;
    transform: none !important;
    margin: 0 !important;
  }
  .page:last-child { break-after: auto; page-break-after: auto; }
  @page { size: A4; margin: 0; }
}

/* Formularelemente werden für html2canvas in stabile Textboxen umgewandelt. */
.export-page {
  position: fixed !important;
  left: -10000px !important;
  top: 0 !important;
  transform: none !important;
  margin: 0 !important;
  box-shadow: none !important;
  z-index: -1 !important;
}

.export-page .no-export { display: none !important; }

.export-value {
  min-height: 34px;
  align-items: center;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: flex;
}

.export-value.multiline {
  height: 56px;
  align-items: flex-start;
  overflow: hidden;
}

.export-value.calculated {
  color: var(--teal-deep);
  background: var(--teal-soft);
  font-weight: 850;
}

.export-value.select-value {
  height: 30px;
  min-height: 30px;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 5px;
  font-size: 9px;
}

.export-value.placeholder-value { color: #8a969b; }
.export-page .card { overflow: hidden; }
.export-page .image-remove,
.export-page input[type="file"] { display: none !important; }
