/* ==========================================================================
   MakerToolHub – Widget (schwebende Live-Demo, Hero-Vorschau, Branchen-Dialog)
   Bewusst isoliert: nutzt nur eigene --mth-Variablen und das Präfix .mth-,
   damit es später als Embed auf Fremdseiten laufen kann.
   ========================================================================== */

.mth-launcher,
.mth-widget,
.mth-print-sheet {
  --mth-primary: #14382b;
  --mth-primary-hover: #1d4d3b;
  --mth-primary-soft: #e3efe8;
  --mth-primary-softer: #f1f7f3;
  --mth-accent: #e8872b;
  --mth-accent-hover: #d97a1f;
  --mth-accent-soft: #fdf0e1;
  --mth-accent-ink: #6b3a08;
  --mth-ink: #1f2528;
  --mth-muted: #5a6368;
  --mth-line: #dfe3e1;
  --mth-line-strong: #c8cecb;
  --mth-surface: #f6f7f6;
  --mth-danger: #b3402a;
  --mth-danger-soft: #fbeae6;
  --mth-focus: #c96f17;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  line-height: 1.5;
}

.mth-widget *,
.mth-widget *::before,
.mth-widget *::after,
.mth-launcher *,
.mth-launcher *::before,
.mth-launcher *::after {
  box-sizing: border-box;
}

.mth-widget [hidden],
.mth-launcher[hidden] {
  display: none !important;
}

.mth-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Startbutton ---------- */
.mth-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 22px 0 18px;
  background: var(--mth-primary);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(15, 44, 33, 0.3);
  color: #ffffff;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.mth-launcher:hover {
  background: var(--mth-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 44, 33, 0.34);
}

.mth-launcher:focus-visible {
  outline: 3px solid var(--mth-focus);
  outline-offset: 3px;
}

.mth-launcher svg {
  flex: none;
}

.mth-launcher-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: var(--mth-accent);
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.mth-launcher.is-open .mth-launcher-dot {
  display: none;
}

.mth-launcher.is-static {
  position: static;
  height: 50px;
  padding: 0 18px 0 14px;
  font-size: 0.92rem;
  flex: none;
}

@media (max-width: 600px) {
  .mth-launcher:not(.is-static) {
    right: 14px;
    bottom: 14px;
    height: 54px;
    padding: 0 18px 0 14px;
  }
  /* Auf Smartphones füllt das geöffnete Widget fast den Bildschirm; der Startbutton wird dann ausgeblendet */
  .mth-launcher.is-open:not(.is-static) {
    display: none;
  }
}

/* ---------- Widget-Fenster ---------- */
.mth-widget {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--mth-line);
  border-radius: 18px;
  color: var(--mth-ink);
  font-size: 1rem;
  overflow: hidden;
}

.mth-widget.is-floating {
  position: fixed;
  right: 20px;
  bottom: 90px;
  z-index: 901;
  width: 400px;
  max-width: calc(100vw - 24px);
  height: 680px;
  max-height: calc(100vh - 112px);
  max-height: calc(100dvh - 112px);
  box-shadow: 0 20px 60px rgba(15, 44, 33, 0.28);
  animation: mth-pop 0.22s ease both;
}

.mth-widget.is-inline {
  position: relative;
  width: 100%;
  height: 560px;
  box-shadow: 0 12px 36px rgba(15, 44, 33, 0.16);
}

.mth-widget.is-inline.is-compact {
  max-width: 380px;
}

/* Hero-Vorschau */
.hero-widget-mount .mth-widget.is-inline {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-width: 380px;
}

/* Branchen-Dialog */
.dialog-widget-mount .mth-widget.is-inline {
  height: min(600px, 68vh);
  height: min(600px, 68dvh);
  min-height: 420px;
  box-shadow: none;
}

@media (max-width: 600px) {
  .mth-widget.is-floating {
    top: 8px;
    top: max(8px, env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    bottom: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    height: auto;
    max-height: none;
    border-radius: 16px;
  }
}

@keyframes mth-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@keyframes mth-fade {
  from { opacity: 0; transform: translateX(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Kopfbereich ---------- */
.mth-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  padding: 14px 14px 14px 18px;
  background: var(--mth-primary);
  color: #ffffff;
}

.mth-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 12px;
}

.mth-header-text {
  flex: 1;
  min-width: 0;
}

.mth-company {
  display: block;
  overflow: hidden;
  font-size: 0.8rem;
  opacity: 0.8;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mth-title {
  margin: 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mth-close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.mth-close:hover {
  background: rgba(255, 255, 255, 0.16);
}
.mth-close:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: -3px;
}

/* ---------- Fortschritt ---------- */
.mth-progress {
  flex: none;
  padding: 12px 18px 14px;
  background: #ffffff;
  border-bottom: 1px solid var(--mth-line);
}

.mth-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--mth-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.mth-progress-track {
  height: 6px;
  margin-top: 8px;
  background: var(--mth-line);
  border-radius: 999px;
  overflow: hidden;
}

.mth-progress-fill {
  width: 0;
  height: 100%;
  background: var(--mth-primary-hover);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ---------- Inhalt ---------- */
.mth-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
}

.mth-body:focus {
  outline: none;
}

.mth-step {
  animation: mth-fade 0.2s ease both;
}

.mth-question {
  margin: 0 0 6px;
  color: var(--mth-primary);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
}

.mth-help {
  margin: 0 0 16px;
  color: var(--mth-muted);
  font-size: 0.9rem;
}

.mth-group-label {
  display: block;
  margin: 20px 0 8px;
  color: var(--mth-ink);
  font-size: 0.9rem;
  font-weight: 700;
}

/* ---------- Auswahlkarten ---------- */
.mth-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.mth-options.is-single {
  grid-template-columns: 1fr;
}

@media (max-width: 360px) {
  .mth-options {
    grid-template-columns: 1fr;
  }
}

.mth-option {
  position: relative;
  display: block;
  min-width: 0;
  cursor: pointer;
}

.mth-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.mth-option-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1.5px solid var(--mth-line-strong);
  border-radius: 12px;
  font-size: 0.93rem;
  font-weight: 500;
  line-height: 1.3;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.mth-option:hover .mth-option-box {
  border-color: #9db8a9;
}

.mth-option-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 22px;
  height: 22px;
  background: #ffffff;
  border: 1.5px solid #a3aca8;
  border-radius: 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.mth-option.is-radio .mth-option-mark {
  border-radius: 50%;
}

.mth-option-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.mth-option-sub {
  color: var(--mth-muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.mth-option input:checked + .mth-option-box {
  background: var(--mth-primary-softer);
  border-color: var(--mth-primary);
  box-shadow: inset 0 0 0 1px var(--mth-primary);
}

.mth-option input:checked + .mth-option-box .mth-option-mark {
  background-color: var(--mth-primary);
  border-color: var(--mth-primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'%3E%3Cpath d='M5.5 11.5l3.8 3.8 7.2-8' fill='none' stroke='%23ffffff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
}

.mth-option.is-radio input:checked + .mth-option-box .mth-option-mark {
  background-image: radial-gradient(circle, #ffffff 0 30%, transparent 34%);
}

.mth-option input:focus-visible + .mth-option-box {
  outline: 3px solid var(--mth-focus);
  outline-offset: 2px;
}

/* ---------- Eingabefelder ---------- */
.mth-field {
  margin-top: 16px;
}

.mth-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 380px) {
  .mth-field-row {
    grid-template-columns: 1fr;
  }
}

.mth-label {
  display: block;
  margin-bottom: 6px;
  color: var(--mth-ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.mth-optional {
  color: var(--mth-muted);
  font-weight: 400;
}

.mth-input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1.5px solid var(--mth-line-strong);
  border-radius: 10px;
  color: var(--mth-ink);
  font: inherit;
  font-size: 1rem; /* verhindert Zoom auf iOS */
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea.mth-input {
  min-height: 96px;
  resize: vertical;
}

.mth-input:hover {
  border-color: #a3aca8;
}

.mth-input:focus {
  outline: none;
  border-color: var(--mth-primary-hover);
  box-shadow: 0 0 0 3px rgba(42, 102, 80, 0.25);
}

.mth-input[aria-invalid="true"] {
  border-color: var(--mth-danger);
  background: #fffafa;
}

.mth-hint {
  margin: 6px 0 0;
  color: var(--mth-muted);
  font-size: 0.8rem;
}

.mth-error {
  margin: 6px 0 0;
  color: var(--mth-danger);
  font-size: 0.82rem;
  font-weight: 600;
}
.mth-error:empty {
  display: none;
}

.mth-alert {
  margin: 16px 0 0;
  padding: 10px 14px;
  background: var(--mth-danger-soft);
  border: 1px solid #efc4ba;
  border-radius: 10px;
  color: #7d2b1b;
  font-size: 0.88rem;
  font-weight: 600;
}
.mth-alert:empty {
  display: none;
}

.mth-privacy {
  margin: 18px 0 0;
  padding: 12px 14px;
  background: var(--mth-surface);
  border-radius: 10px;
  color: var(--mth-muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.mth-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  font-size: 0.88rem;
  line-height: 1.5;
  cursor: pointer;
}
.mth-consent input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--mth-primary);
  cursor: pointer;
}
.mth-consent input:focus-visible {
  outline: 3px solid var(--mth-focus);
  outline-offset: 2px;
}

/* ---------- Fußbereich mit Buttons ---------- */
.mth-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 12px 18px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: #ffffff;
  border-top: 1px solid var(--mth-line);
}

.mth-spacer {
  flex: 1;
}

.mth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 1.5px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mth-btn:focus-visible {
  outline: 3px solid var(--mth-focus);
  outline-offset: 2px;
}

.mth-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.mth-btn-primary {
  background: var(--mth-primary);
  border-color: var(--mth-primary);
  color: #ffffff;
}
.mth-btn-primary:hover:not(:disabled) {
  background: var(--mth-primary-hover);
  border-color: var(--mth-primary-hover);
}

.mth-btn-accent {
  background: var(--mth-accent);
  border-color: var(--mth-accent);
  color: var(--mth-ink);
}
.mth-btn-accent:hover:not(:disabled) {
  background: var(--mth-accent-hover);
  border-color: var(--mth-accent-hover);
}

.mth-btn-secondary {
  background: #ffffff;
  border-color: var(--mth-primary);
  color: var(--mth-primary);
}
.mth-btn-secondary:hover:not(:disabled) {
  background: var(--mth-primary-softer);
}

.mth-btn-ghost {
  background: transparent;
  border-color: var(--mth-line-strong);
  color: var(--mth-ink);
}
.mth-btn-ghost:hover:not(:disabled) {
  background: var(--mth-surface);
}

.mth-btn-sm {
  min-height: 42px;
  padding: 0 14px;
  font-size: 0.88rem;
}

.mth-footer .mth-btn-primary,
.mth-footer .mth-btn-accent {
  flex: 1;
}

/* ---------- Zusammenfassung ---------- */
.mth-demo-banner {
  margin: 0 0 16px;
  padding: 10px 12px;
  background: var(--mth-accent-soft);
  border-left: 4px solid var(--mth-accent);
  border-radius: 0 8px 8px 0;
  color: var(--mth-accent-ink);
  font-size: 0.84rem;
  line-height: 1.5;
}

.mth-summary-section {
  margin-bottom: 18px;
}

.mth-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 4px;
}

.mth-summary-title {
  margin: 0;
  color: var(--mth-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mth-link {
  padding: 4px 2px;
  background: none;
  border: 0;
  color: var(--mth-primary-hover);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.mth-link:hover {
  color: var(--mth-primary);
}
.mth-link:focus-visible {
  outline: 3px solid var(--mth-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.mth-summary-list {
  margin: 0;
}

.mth-summary-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--mth-line);
  font-size: 0.9rem;
}

.mth-summary-row dt {
  color: var(--mth-muted);
}

.mth-summary-row dd {
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

@media (max-width: 380px) {
  .mth-summary-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.mth-estimate {
  margin: 18px 0;
  padding: 16px;
  background: var(--mth-primary-softer);
  border: 1px solid #c6dacf;
  border-radius: 14px;
}

.mth-estimate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.mth-estimate-title {
  color: var(--mth-primary);
  font-weight: 700;
}

.mth-badge-demo {
  display: inline-block;
  padding: 2px 10px;
  background: var(--mth-accent-soft);
  border-radius: 999px;
  color: var(--mth-accent-ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mth-estimate-amount {
  margin: 8px 0;
  color: var(--mth-primary);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.mth-estimate-lines {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mth-estimate-lines li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  color: var(--mth-muted);
  font-size: 0.86rem;
}

.mth-estimate-lines li span:last-child {
  flex: none;
  color: var(--mth-ink);
  font-weight: 600;
  white-space: nowrap;
}

.mth-estimate-note {
  margin: 10px 0 0;
  color: var(--mth-muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.mth-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.mth-copy-status {
  margin: 10px 0 0;
  color: var(--mth-primary-hover);
  font-size: 0.86rem;
  font-weight: 600;
}
.mth-copy-status:empty {
  display: none;
}

/* ---------- Bestätigung ---------- */
.mth-success {
  padding: 28px 6px 8px;
  text-align: center;
}

.mth-success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  background: var(--mth-primary-soft);
  border-radius: 50%;
  color: var(--mth-primary);
}

.mth-success h3 {
  margin: 0 0 8px;
  color: var(--mth-primary);
  font-size: 1.25rem;
  line-height: 1.3;
}

.mth-success p {
  margin: 0 0 10px;
  color: var(--mth-muted);
  font-size: 0.92rem;
}

/* ---------- Druckansicht der Zusammenfassung ---------- */
.mth-print-sheet {
  display: none;
}

@media print {
  body.mth-printing > *:not(.mth-print-sheet) {
    display: none !important;
  }

  body.mth-printing {
    background: #ffffff !important;
  }

  body.mth-printing .mth-print-sheet {
    display: block !important;
    padding: 0;
    color: #000000;
    font-size: 11pt;
  }

  .mth-print-sheet h1 {
    margin: 0 0 4pt;
    color: #14382b;
    font-size: 20pt;
  }

  .mth-print-sheet h2 {
    margin: 16pt 0 6pt;
    color: #14382b;
    font-size: 12pt;
  }

  .mth-print-sheet .mth-print-meta {
    margin: 0 0 12pt;
    color: #444444;
    font-size: 10pt;
  }

  .mth-print-sheet table {
    width: 100%;
    border-collapse: collapse;
  }

  .mth-print-sheet th,
  .mth-print-sheet td {
    padding: 5pt 6pt;
    border-bottom: 0.5pt solid #bbbbbb;
    font-size: 10.5pt;
    text-align: left;
    vertical-align: top;
  }

  .mth-print-sheet th {
    width: 32%;
    color: #444444;
    font-weight: 600;
  }

  .mth-print-sheet .mth-print-disclaimer {
    margin-top: 14pt;
    padding: 8pt 10pt;
    border: 0.75pt solid #999999;
    font-size: 9.5pt;
  }
}

/* ---------- Weniger Bewegung ---------- */
@media (prefers-reduced-motion: reduce) {
  .mth-widget,
  .mth-widget *,
  .mth-launcher {
    animation: none !important;
    transition: none !important;
  }
}