:root {
  --teal-dark: #0a4f57;
  --teal-mid: #12897f;
  --teal-bright: #14a89a;
  --mint-light: #8ff2d2;
  --ink: #103534;
  --ink-soft: #4b6c6a;
  --card-bg: rgba(255, 255, 255, 0.97);
  --error: #c0392b;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow-card: 0 24px 60px rgba(6, 40, 40, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  line-height: 1.5;
}

/* Premium Petrol/Mint-Verlauf, komplett aus CSS erzeugt (kein Bild-Asset). */
.page-bg {
  position: relative;
  min-height: 100vh;
  background-color: var(--teal-dark);
  background-image:
    radial-gradient(1100px 700px at 88% 4%, rgba(255, 255, 255, 0.38), transparent 60%),
    linear-gradient(135deg, var(--teal-dark) 0%, var(--teal-mid) 48%, var(--mint-light) 100%);
  /* Nur waagerecht clippen: .page-bg sitzt auf dem <body>, und ein dortiges
     overflow:hidden würde an den Viewport durchgereicht – die Seite ließe sich
     dann gar nicht mehr scrollen, sobald der Inhalt höher als der Bildschirm
     ist (z. B. im Link-Generator). */
  overflow-x: hidden;
  /* Spalten-Flexbox: Inhalt oben, Rechtliches immer am unteren Rand. */
  display: flex;
  flex-direction: column;
}

.page-bg::before,
.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Dezente, an das Markenzeichen angelehnte Facetten */
.page-bg::before {
  background-image:
    linear-gradient(115deg, transparent 46%, rgba(255, 255, 255, 0.06) 47%, rgba(255, 255, 255, 0.06) 49%, transparent 50%),
    linear-gradient(65deg, transparent 58%, rgba(255, 255, 255, 0.05) 59%, rgba(255, 255, 255, 0.05) 61%, transparent 62%),
    linear-gradient(155deg, transparent 18%, rgba(6, 36, 38, 0.14) 19%, rgba(6, 36, 38, 0.14) 32%, transparent 33%);
}

/* Feines Raster, wie im Marken-Hintergrund, unten links etwas kräftiger */
.page-bg::after {
  background-image:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 44px);
  -webkit-mask-image: linear-gradient(135deg, rgba(0, 0, 0, 0.9), transparent 55%);
  mask-image: linear-gradient(135deg, rgba(0, 0, 0, 0.9), transparent 55%);
}

.brand {
  position: absolute;
  top: 28px;
  left: 28px;
  z-index: 2;
}

.brand-logo {
  display: block;
  height: 34px;
  width: auto;
}

.page-wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 20px 24px;
}

.content {
  width: 100%;
  display: flex;
  justify-content: center;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 36px 28px;
  width: 100%;
  max-width: 560px;
  backdrop-filter: blur(6px);
}

.card--result {
  text-align: center;
  max-width: 480px;
  padding: 48px 32px;
}

/* Start-Bildschirm (vor dem ersten Klick auf "Jetzt bewerben") */
.start-screen h1 {
  margin: 0 0 10px;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  color: var(--teal-dark);
}

.start-screen p {
  margin: 0 0 28px;
  color: var(--ink-soft);
}

.start-screen .btn {
  width: 100%;
}

.js .form-shell {
  display: none;
}

.js.started .form-shell {
  display: block;
}

.js.started .start-screen {
  display: none;
}

.step-subtitle {
  margin: -12px 0 22px;
  color: var(--ink-soft);
}

/* Progress indicator */
.progress {
  margin-bottom: 24px;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(10, 79, 87, 0.12);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  width: 20%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal-mid), var(--mint-light));
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 600;
}

/* Steps */
.step {
  border: none;
  margin: 0 0 8px;
  padding: 0;
  display: block;
}

.js .step {
  display: none;
}

.js .step.is-active {
  display: block;
  animation: step-in 0.25s ease;
}

@keyframes step-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--teal-dark);
  padding: 0;
  margin-bottom: 18px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 6px;
  color: var(--ink);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid #d8e6e4;
  font-size: 1rem;
  font-family: inherit;
  background: #fafffe;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--teal-bright);
  box-shadow: 0 0 0 4px rgba(20, 168, 154, 0.15);
}

.field input.invalid,
.options.invalid {
  border-color: var(--error);
}

.field-error,
.form-error {
  color: var(--error);
  font-size: 0.85rem;
  margin: 6px 0 0;
  font-weight: 600;
}

/* Options (radio / checkbox) */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid #d8e6e4;
  border-radius: var(--radius-md);
  cursor: pointer;
  background: #fafffe;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.option:hover {
  border-color: var(--teal-bright);
}

.option input {
  width: 20px;
  height: 20px;
  accent-color: var(--teal-mid);
  flex-shrink: 0;
}

.option:has(input:checked),
.option.is-checked {
  border-color: var(--teal-mid);
  background: rgba(18, 137, 127, 0.07);
  box-shadow: 0 0 0 3px rgba(20, 168, 154, 0.12);
}

.option-label {
  font-size: 0.98rem;
  color: var(--ink);
}

/* Buttons */
.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid rgba(10, 79, 87, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 26px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: linear-gradient(120deg, var(--teal-dark), var(--teal-bright));
  color: #fff;
  box-shadow: 0 10px 24px rgba(10, 79, 87, 0.28);
  margin-left: auto;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(10, 79, 87, 0.34);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  color: var(--teal-dark);
  border: 1.5px solid var(--teal-dark);
  padding: 12.5px 22px;
}

.btn-ghost:hover {
  background: rgba(10, 79, 87, 0.08);
}

.card--result .btn {
  margin-top: 12px;
}

/* Result pages */
.result-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.result-icon--success {
  color: var(--teal-mid);
  background: rgba(18, 137, 127, 0.1);
}

.result-icon--info {
  color: var(--teal-dark);
  background: rgba(10, 79, 87, 0.08);
}

.card--result h1 {
  color: var(--teal-dark);
  margin: 0 0 12px;
  font-size: 1.6rem;
}

.card--result p {
  color: var(--ink-soft);
  margin: 0 0 8px;
}

.privacy-note {
  margin-top: 24px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.5;
}

/* Mobile-first refinements for larger screens */
@media (min-width: 600px) {
  .card {
    padding: 48px 52px;
  }

  .start-screen h1 {
    font-size: 2rem;
  }

  .brand-logo {
    height: 40px;
  }
}

@media (max-width: 400px) {
  .page-wrap {
    padding: 76px 12px 24px;
  }

  .card {
    padding: 28px 20px;
  }
}

/* ==========================================================================
   Interner Link-Generator (/admin) – Login, Generator, Katalogpflege
   ========================================================================== */

.card--login {
  max-width: 420px;
}

.card--admin {
  max-width: 720px;
}

.card--admin h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
  color: var(--teal-dark);
}

.card--login h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  color: var(--teal-dark);
}

.card-subtitle {
  margin: 0 0 22px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.admin-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(10, 79, 87, 0.12);
}

.admin-section:first-of-type {
  border-top: none;
  padding-top: 0;
}

.admin-section h2 {
  font-size: 1.05rem;
  color: var(--teal-dark);
  margin: 0 0 14px;
}

.admin-label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 6px;
  color: var(--ink);
}

.card--admin select,
.card--login input[type="password"],
.card--admin input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1.5px solid #d8e6e4;
  font-size: 1rem;
  font-family: inherit;
  background: #fafffe;
  color: var(--ink);
}

.card--admin select:focus,
.card--admin input:focus,
.card--login input:focus {
  outline: none;
  border-color: var(--teal-bright);
  box-shadow: 0 0 0 4px rgba(20, 168, 154, 0.15);
}

.btn-small {
  padding: 10px 18px;
  font-size: 0.9rem;
  margin-left: 0;
  white-space: nowrap;
}

/* Ergebnis-Zeile mit Link + Kopieren */
.link-box {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.link-box input {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem !important;
  background: #f2fbf9 !important;
}

.hint {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 8px 0 0;
}

/* Katalog-Listen */
.entry-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.entry-group {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 14px 0 4px;
}

.entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(10, 79, 87, 0.08);
}

.entry-label {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
}

.entry-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--teal-dark);
  background: rgba(20, 168, 154, 0.12);
  padding: 3px 8px;
  border-radius: 999px;
}

.btn-link-danger {
  background: none;
  border: none;
  color: var(--error);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 4px;
}

.btn-link-danger:hover {
  text-decoration: underline;
}

.add-form {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
  margin-top: 4px;
}

.add-form input[type="text"] {
  flex: 1;
  min-width: 200px;
}

.add-form select {
  width: auto !important;
  flex: 0 0 auto;
}

/* Meldungen */
.flash {
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 18px;
}

.flash--ok {
  background: rgba(20, 168, 154, 0.14);
  color: var(--teal-dark);
}

.flash--info {
  background: rgba(10, 79, 87, 0.08);
  color: var(--teal-dark);
}

.flash--error {
  background: rgba(192, 57, 43, 0.1);
  color: var(--error);
}

@media (max-width: 560px) {
  .admin-head {
    flex-direction: column;
  }

  .link-box {
    flex-direction: column;
  }
}

/* Rechtliches – Impressum/Datenschutz der Hauptseite, auf allen Seiten */
.legal-bar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 0 20px 28px;
}

.legal-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.legal-link:hover,
.legal-link:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.75);
}

.legal-link:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ==========================================================================
   Formular-Designer (/admin/fragen)
   ========================================================================== */

.switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.switcher label {
  font-weight: 600;
  font-size: 0.9rem;
}

.switcher select {
  flex: 1;
  min-width: 220px;
}

.inherit-note {
  background: rgba(20, 168, 154, 0.09);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.inherit-note p {
  margin: 0;
  font-size: 0.9rem;
  flex: 1;
  min-width: 220px;
}

.count-badge {
  display: inline-block;
  background: rgba(20, 168, 154, 0.15);
  color: var(--teal-dark);
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 0.8rem;
  margin-left: 4px;
}

.hint-inline {
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

/* Eine Frage im Designer */
.question {
  border: 1.5px solid #dceceb;
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  background: #fbfffe;
}

.question[open] {
  border-color: var(--teal-bright);
}

.question-summary {
  cursor: pointer;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  list-style: none;
}

.question-summary::-webkit-details-marker {
  display: none;
}

.question-number {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--teal-dark);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.question-label {
  flex: 1;
  min-width: 120px;
  font-weight: 600;
  font-size: 0.95rem;
}

.question-type {
  font-size: 0.75rem;
  color: var(--ink-soft);
  background: rgba(10, 79, 87, 0.07);
  border-radius: 999px;
  padding: 2px 9px;
}

.ko-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--error);
  background: rgba(192, 57, 43, 0.1);
  border-radius: 999px;
  padding: 2px 9px;
}

.question-form {
  padding: 4px 14px 14px;
  border-top: 1px solid rgba(10, 79, 87, 0.08);
}

.answer-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.answer-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.answer-row input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 9px 12px !important;
  font-size: 0.92rem !important;
}

.answer-ko {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--error);
  cursor: pointer;
  flex-shrink: 0;
}

.answer-ko input {
  width: 16px;
  height: 16px;
  accent-color: var(--error);
}

.question-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.question-tools {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 0 14px 12px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--teal-dark);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: none;
}

.btn-link:hover:not(:disabled) {
  text-decoration: underline;
}

.btn-link:disabled {
  color: #a9c2c0;
  cursor: default;
}

.hint--block {
  margin: 0 0 16px;
}

/* Reiter im Verwaltungsbereich */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(10, 79, 87, 0.12);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--teal-dark);
  text-decoration: none;
  background: rgba(10, 79, 87, 0.06);
  cursor: pointer;
}

.tab:hover {
  background: rgba(10, 79, 87, 0.12);
}

.tab.is-active {
  background: linear-gradient(120deg, var(--teal-dark), var(--teal-bright));
  color: #fff;
}

.tab-count {
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 1px 7px;
}

.tab:not(.is-active) .tab-count {
  background: rgba(10, 79, 87, 0.12);
}

/* Panels tragen den Abstand selbst, die Trennlinie entfällt */
.admin-section.tab-panel {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* Kompaktere Listen, damit weniger gescrollt werden muss */
.entry {
  padding: 7px 0;
}

.entry-label {
  font-size: 0.92rem;
}

.question--new {
  border-style: dashed;
}

.question--new .question-number {
  background: var(--teal-bright);
  font-size: 1rem;
}

.cond-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--teal-dark);
  background: rgba(20, 168, 154, 0.15);
  border-radius: 999px;
  padding: 2px 9px;
}

/* Anmeldung über Microsoft Entra ID */
.btn-ms {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  border: 1.5px solid #d8e6e4;
  background: #fff;
  color: #1b1b1b;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-ms:hover {
  border-color: var(--teal-bright);
  box-shadow: 0 6px 18px rgba(10, 79, 87, 0.12);
}

.ms-logo {
  flex-shrink: 0;
}
