:root {
  --bg: #eef3f2;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --soft: #f5f8f7;
  --ink: #122127;
  --muted: #61737d;
  --primary: #0c5962;
  --primary-deep: #082f36;
  --primary-soft: #dff1f2;
  --accent: #dc6833;
  --accent-soft: #ffe6d6;
  --border: rgba(190, 205, 202, 0.72);
  --shadow: 0 22px 65px rgba(10, 33, 39, 0.16);
  --success: #1c7a50;
  --warning: #a46411;
  --danger: #bd3e42;
  --info: #236eb3;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(145deg, rgba(8, 47, 54, 0.12), rgba(220, 104, 51, 0.07) 52%, rgba(35, 110, 179, 0.07)),
    var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

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

.app-shell {
  width: min(1060px, 100%);
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 16px;
}

.hero {
  min-height: auto;
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 20px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 24px;
  padding: 18px;
  color: var(--white);
  background: linear-gradient(135deg, rgba(8, 47, 54, 0.98), rgba(11, 78, 86, 0.95) 62%, rgba(164, 76, 39, 0.95));
  box-shadow: var(--shadow);
}

.hero::after {
  content: none;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--white);
  color: var(--primary-deep);
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.brand-copy {
  flex: 1;
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 17px;
}

.brand-copy span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  font-weight: 750;
}

.app-home {
  align-content: start;
}

.home-headline {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 5px;
  padding-top: 4px;
}

.home-headline h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.05;
}

.quick-actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quick-action {
  min-height: 112px;
  display: grid;
  align-content: space-between;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.13);
  color: var(--white);
  padding: 14px;
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(16px);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.quick-action:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.19);
  border-color: rgba(255, 255, 255, 0.38);
}

.quick-number {
  width: 38px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: var(--white);
  font-size: 12px;
  font-weight: 950;
}

.quick-action:nth-child(2) .quick-number {
  background: var(--info);
}

.quick-action:nth-child(3) .quick-number {
  background: var(--warning);
}

.quick-action:nth-child(4) .quick-number {
  background: var(--success);
}

.quick-action strong {
  font-size: 18px;
  line-height: 1.12;
}

.quick-action small {
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.25;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  padding: 9px 13px;
  color: var(--white);
  font-size: 13px;
  font-weight: 950;
  backdrop-filter: blur(14px);
}

.admin-link {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  padding: 9px 13px;
  color: var(--white);
  font-size: 13px;
  font-weight: 950;
  text-decoration: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: end;
}

.hero-copy {
  width: min(720px, 100%);
}

.eyebrow,
.helper {
  margin: 0 0 8px;
  color: #ffc8a9;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.01;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 25px;
  line-height: 1.18;
  letter-spacing: 0;
}

.hero-copy p:last-child {
  width: min(650px, 100%);
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
  line-height: 1.5;
}

.start-button {
  width: min(280px, 100%);
  margin-top: 22px;
  background: linear-gradient(135deg, var(--accent), #b94f22);
  color: var(--white);
  box-shadow: 0 16px 30px rgba(220, 104, 51, 0.28);
}

.hero-card {
  display: grid;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px);
}

.hero-card span {
  color: #ffc8a9;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.hero-card strong {
  font-size: 24px;
  line-height: 1.1;
}

.hero-card p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.42;
}

.install-prompt {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(12, 89, 98, 0.18);
  border-radius: 18px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 34px rgba(10, 33, 39, 0.11);
}

.install-prompt[hidden] {
  display: none;
}

.install-prompt p {
  margin: 3px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.mini-button,
.icon-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.mini-button,
.text-button {
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  padding: 9px 13px;
  font-size: 13px;
  font-weight: 950;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.tabbar,
.stepbar {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 14px 38px rgba(10, 33, 39, 0.12);
  backdrop-filter: blur(18px);
}

.stepbar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tab-button,
.step-tab,
.segment {
  min-height: 48px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 950;
  cursor: pointer;
}

.tab-button.active,
.step-tab.active,
.segment.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: var(--white);
  box-shadow: 0 12px 24px rgba(12, 89, 98, 0.22);
}

.tab-view,
.wizard-panel {
  display: none;
  gap: 16px;
}

.tab-view.active,
.wizard-panel.active {
  display: grid;
}

.wizard {
  display: grid;
  gap: 16px;
}

.wizard[hidden] {
  display: none;
}

.workspace-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  padding: 10px;
  box-shadow: 0 12px 28px rgba(10, 33, 39, 0.09);
}

.workspace-topline span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 16px 42px rgba(10, 33, 39, 0.1);
  backdrop-filter: blur(18px);
}

.muted,
.footer {
  color: var(--muted);
  line-height: 1.5;
}

.progress-wrap {
  display: grid;
  gap: 9px;
  padding: 0 4px;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(12, 89, 98, 0.13);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width 180ms ease;
}

#progressText {
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
}

.question-panel,
.actions-panel,
.calculator-panel,
.result-card,
.ai-panel,
.barcode-panel,
.transport-sheet-panel {
  display: grid;
  gap: 15px;
}

.question-panel .helper,
.actions-panel .helper,
.calculator-panel .helper,
.barcode-panel .helper {
  color: var(--accent);
}

.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.option-button {
  min-height: 88px;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--soft);
  padding: 15px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.option-button:hover {
  transform: translateY(-1px);
  border-color: rgba(12, 89, 98, 0.36);
  box-shadow: 0 12px 25px rgba(10, 33, 39, 0.1);
}

.option-button.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px rgba(12, 89, 98, 0.12), 0 10px 24px rgba(12, 89, 98, 0.13);
}

.check-dot {
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid #bdcdca;
  border-radius: 50%;
  color: transparent;
  font-size: 15px;
  font-weight: 950;
}

.selected .check-dot {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--white);
}

.option-label {
  display: grid;
  gap: 4px;
  font-weight: 950;
  line-height: 1.25;
}

.option-hint {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.sheet-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.sheet-toolbar h2,
.sheet-toolbar p {
  margin-bottom: 0;
}

.sheet-badge {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 950;
}

.transport-sheet {
  display: grid;
  gap: 10px;
}

.sheet-image-frame {
  position: relative;
  width: min(520px, 100%);
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 20px 45px rgba(10, 33, 39, 0.16);
}

.sheet-image-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.sheet-text-field {
  position: absolute;
  z-index: 2;
  min-height: 14px;
  color: #111;
  font-family: "Courier New", monospace;
  font-size: clamp(8px, 1.8vw, 12px);
  font-weight: 850;
  line-height: 1.12;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.sheet-text-field.multiline {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.sheet-hotspot {
  position: absolute;
  z-index: 3;
  width: 4.1%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid rgba(8, 47, 54, 0.88);
  background: rgba(255, 255, 255, 0.58);
  color: #111;
  font-family: "Courier New", monospace;
  font-size: clamp(14px, 3vw, 22px);
  font-weight: 950;
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.sheet-hotspot.active {
  outline: 3px solid rgba(220, 104, 51, 0.34);
}

.sheet-hotspot.checked {
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--primary);
  color: var(--primary-deep);
}

.sheet-image-hint {
  margin: 0;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.hotspot-editor-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
}

.hotspot-canvas {
  position: sticky;
  top: 14px;
}

.sheet-hotspot-editor-frame {
  position: relative;
  width: min(520px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 45px rgba(10, 33, 39, 0.16);
  touch-action: none;
}

.sheet-hotspot-editor-frame img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  pointer-events: none;
}

.admin-sheet-hotspot {
  touch-action: none;
  box-shadow: 0 8px 18px rgba(8, 47, 54, 0.22);
}

.hotspot-list {
  display: grid;
  max-height: 720px;
  overflow: auto;
  gap: 12px;
  padding-right: 4px;
}

.hotspot-row {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--soft);
  padding: 12px;
}

.hotspot-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.hotspot-row-head strong {
  flex: 1;
}

.hotspot-row-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.hotspot-position-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.compact-toggle {
  min-height: auto;
  padding: 10px;
}

.barcode-reader {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(8, 47, 54, 0.92), rgba(12, 89, 98, 0.82)),
    var(--primary-deep);
  color: var(--white);
}

.barcode-reader::before {
  content: "Barcode mittig in den Rahmen halten";
  position: absolute;
  inset: auto 14px 14px;
  z-index: 2;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.barcode-video {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
}

.barcode-scan-frame {
  position: absolute;
  width: min(72%, 420px);
  aspect-ratio: 1.8;
  border: 3px solid rgba(255, 255, 255, 0.86);
  border-radius: 14px;
  box-shadow: 0 0 0 999px rgba(5, 22, 26, 0.36);
}

.barcode-raw-field textarea {
  width: 100%;
  min-height: 126px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 760;
  line-height: 1.45;
}

.file-button {
  display: grid;
  place-items: center;
  text-align: center;
}

.file-button input {
  display: none;
}

.barcode-matches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-hint {
  margin: 0;
  border: 1px solid rgba(35, 110, 179, 0.2);
  border-radius: 14px;
  background: #edf5ff;
  color: var(--info);
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.42;
}

.barcode-match {
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-deep);
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 950;
}

.button-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.button {
  min-height: 56px;
  border: 0;
  border-radius: 15px;
  padding: 0 16px;
  font-weight: 950;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: var(--white);
  box-shadow: 0 12px 24px rgba(12, 89, 98, 0.23);
}

.accent {
  background: linear-gradient(135deg, var(--accent), #b94f22);
  color: var(--white);
  box-shadow: 0 12px 24px rgba(220, 104, 51, 0.24);
}

.secondary {
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.result-card {
  position: relative;
  overflow: hidden;
}

.result-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
}

.result-card.billable {
  background: #ecf8f1;
  border-color: rgba(28, 122, 80, 0.3);
}

.result-card.clarify {
  background: #fff6e5;
  border-color: rgba(164, 100, 17, 0.3);
}

.result-card.selfPay {
  background: #fff0f0;
  border-color: rgba(189, 62, 66, 0.28);
}

.result-card.incomplete {
  background: #edf5ff;
  border-color: rgba(35, 110, 179, 0.28);
}

.billable::before {
  background: var(--success);
}

.clarify::before {
  background: var(--warning);
}

.selfPay::before {
  background: var(--danger);
}

.incomplete::before {
  background: var(--info);
}

.result-head,
.result-summary,
.notes {
  padding-left: 6px;
}

.result-color {
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.billable .result-color,
.billable #resultTitle {
  color: var(--success);
}

.clarify .result-color,
.clarify #resultTitle {
  color: var(--warning);
}

.selfPay .result-color,
.selfPay #resultTitle {
  color: var(--danger);
}

.incomplete .result-color,
.incomplete #resultTitle {
  color: var(--info);
}

.result-summary {
  margin-bottom: 0;
  font-size: 17px;
  font-weight: 850;
  line-height: 1.48;
}

.notes {
  display: grid;
  gap: 8px;
}

.note {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title-row h2,
.section-title-row p {
  margin-bottom: 0;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.single-upload {
  min-height: 166px;
}

.upload-box {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 144px;
  border: 1px dashed rgba(12, 89, 98, 0.52);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(223, 241, 242, 0.96), rgba(255, 255, 255, 0.9)),
    var(--soft);
  padding: 16px;
  color: var(--primary-deep);
  font-weight: 950;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.upload-box:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 12px 28px rgba(10, 33, 39, 0.11);
}

.upload-box span {
  font-size: 17px;
}

.upload-box small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.upload-box input {
  width: 100%;
  color: var(--muted);
}

.file-name {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 850;
}

.ai-facts {
  display: grid;
  gap: 10px;
}

.ai-fact {
  display: grid;
  grid-template-columns: minmax(130px, 0.55fr) 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--soft);
  padding: 12px;
}

.ai-fact span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.ai-fact strong {
  color: var(--ink);
  line-height: 1.35;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  border-radius: 18px;
  padding: 7px;
  background: var(--soft);
  border: 1px solid var(--border);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field,
.toggle-field {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--soft);
  padding: 13px;
}

.field span,
.toggle-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  font-weight: 950;
}

.toggle-field {
  min-height: 74px;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.toggle-field input {
  width: 24px;
  height: 24px;
  accent-color: var(--primary);
}

.hidden {
  display: none;
}

.calc-result {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.calc-result div {
  display: grid;
  gap: 5px;
  border-radius: 18px;
  padding: 15px;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary));
  color: var(--white);
}

.calc-result span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 850;
}

.calc-result strong {
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1;
}

.calc-hint {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.footer {
  padding: 0 4px 12px;
  font-size: 13px;
}

.admin-shell {
  max-width: 980px;
}

.admin-hero {
  min-height: 270px;
}

.admin-panel {
  display: grid;
  gap: 15px;
}

.json-editor {
  width: 100%;
  min-height: 520px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--soft);
  color: var(--ink);
  padding: 14px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  line-height: 1.45;
}

.admin-editor {
  display: grid;
  gap: 16px;
}

.admin-toolbar,
.admin-save-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-solid);
  padding: 14px;
  box-shadow: 0 12px 30px rgba(10, 33, 39, 0.08);
}

.admin-toolbar {
  position: sticky;
  top: 10px;
  z-index: 10;
}

.admin-toolbar h2,
.admin-toolbar p,
.admin-save-banner p {
  margin-bottom: 0;
}

.admin-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-toolbar-actions .mini-button {
  display: inline-grid;
  min-height: 44px;
  place-items: center;
  text-decoration: none;
}

.admin-save-banner {
  justify-content: flex-start;
  background: #f7fbfa;
}

.save-state-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--info);
  box-shadow: 0 0 0 5px rgba(35, 110, 179, 0.1);
}

.save-state-dot[data-state="success"] {
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(28, 122, 80, 0.12);
}

.save-state-dot[data-state="error"] {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(189, 62, 66, 0.12);
}

.save-state-dot[data-state="saving"] {
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(164, 100, 17, 0.12);
}

.admin-status-text[data-state="success"] {
  color: var(--success);
  font-weight: 950;
}

.admin-status-text[data-state="error"] {
  color: var(--danger);
  font-weight: 950;
}

.admin-status-text[data-state="saving"] {
  color: var(--warning);
  font-weight: 950;
}

.save-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  border-radius: 16px;
  background: var(--success);
  color: var(--white);
  padding: 14px 16px;
  font-weight: 950;
  box-shadow: 0 18px 40px rgba(10, 33, 39, 0.24);
}

.admin-section-card {
  scroll-margin-top: 110px;
}

.admin-subsection-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.admin-subsection-head strong {
  font-size: 15px;
}

.admin-subsection-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-editor[hidden],
#loginPanel[hidden] {
  display: none;
}

.compact-button {
  min-height: 44px;
  width: fit-content;
}

.questions-editor {
  display: grid;
  gap: 14px;
}

.flow-map {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(rgba(12, 89, 98, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(12, 89, 98, 0.06) 1px, transparent 1px),
    #f5f8f7;
  background-size: 28px 28px;
  padding: 16px;
}

.flow-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--soft);
  padding: 12px;
}

.quiz-builder-canvas {
  position: relative;
  min-width: 1120px;
}

.builder-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.builder-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  opacity: 0.86;
}

.builder-line-label {
  fill: var(--primary-deep);
  font-size: 12px;
  font-weight: 800;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  text-anchor: middle;
}

.builder-start-node,
.builder-question-node,
.builder-final-node {
  position: absolute;
  z-index: 1;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(10, 33, 39, 0.2);
}

.builder-start-node {
  min-height: 46px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #7d3b87;
  font-weight: 950;
  border: 2px solid #d8c6dd;
}

.builder-question-node {
  min-height: 112px;
  display: grid;
  gap: 7px;
  padding: 14px;
  background: #454c52;
  color: #fff;
  text-align: left;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.builder-question-node span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.builder-question-node strong {
  line-height: 1.25;
}

.builder-question-node em {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-style: normal;
  font-weight: 750;
}

.builder-final-node {
  min-height: 96px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: #fff;
  font-weight: 950;
}

.admin-question-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--soft);
  padding: 14px;
}

.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.admin-card-head::-webkit-details-marker,
.hotspot-row-head::-webkit-details-marker {
  display: none;
}

.admin-card-head::before,
.hotspot-row-head::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  transform: rotate(-45deg);
  transition: transform 140ms ease;
}

details[open] > .admin-card-head::before,
details[open] > .hotspot-row-head::before {
  transform: rotate(45deg);
}

.admin-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.option-editor {
  display: grid;
  gap: 10px;
}

.admin-option-row {
  display: grid;
  grid-template-columns: 0.65fr 1fr 1fr 1.15fr auto;
  gap: 10px;
  align-items: end;
}

.field select {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 850;
}

.flow-target {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 8px;
  align-items: center;
}

.flow-line {
  position: relative;
  display: block;
  height: 2px;
  background: var(--primary);
}

.flow-line::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--primary);
  border-right: 2px solid var(--primary);
  transform: translateY(-50%) rotate(45deg);
}

.danger-text {
  background: #ffe1e2;
  color: var(--danger);
}

@media (max-width: 820px) {
  .hero {
    min-height: auto;
  }

  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-grid,
  .admin-toolbar,
  .admin-save-banner,
  .options,
  .sheet-options,
  .upload-grid,
  .ai-fact,
  .hotspot-editor-grid,
  .flow-controls,
  .admin-option-row,
  .calc-grid,
  .calc-result {
    grid-template-columns: 1fr;
  }

  .flow-target {
    grid-template-columns: 1fr;
  }

  .admin-toolbar,
  .admin-save-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-toolbar-actions {
    justify-content: stretch;
  }

  .admin-toolbar-actions .mini-button,
  .admin-toolbar-actions .button {
    flex: 1 1 140px;
  }

  .flow-line {
    width: 100%;
  }

  .hotspot-canvas {
    position: static;
  }

  .hero-card {
    width: min(420px, 100%);
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

  .hero {
    min-height: auto;
    border-radius: 22px;
    padding: 15px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .quick-action {
    min-height: 90px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .brand-copy span,
  .status-pill {
    font-size: 12px;
  }

  .install-prompt {
    grid-template-columns: 1fr auto;
  }

  .install-prompt .icon-button {
    grid-column: 2;
  }

  .tabbar {
    top: 4px;
  }

  .stepbar {
    grid-template-columns: 1fr;
  }

  .tab-button,
  .step-tab,
  .segment {
    min-height: 46px;
    font-size: 14px;
  }

  .panel {
    border-radius: 18px;
    padding: 15px;
  }

  h2 {
    font-size: 22px;
  }

  .option-button {
    min-height: 76px;
  }
}
