:root {
  --bg: #f6f4ee;
  --panel: #fffdf8;
  --ink: #1f2933;
  --muted: #52606d;
  --accent: #0f766e;
  --accent-2: #c2410c;
  --line: #d9d3c5;
  --phase-a: #b42318;
  --phase-b: #0369a1;
  --phase-c: #15803d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Verdana", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1000px 450px at -10% -10%, #f4ddc4 0%, rgba(244, 221, 196, 0) 70%),
    radial-gradient(850px 420px at 110% 0%, #d5ebe8 0%, rgba(213, 235, 232, 0) 68%),
    var(--bg);
  min-height: 100vh;
  padding: 20px;
}

.shell {
  max-width: 1250px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.hero,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.06);
}

.hero {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
  align-items: center;
}

.hero h1 {
  margin: 0 0 8px 0;
  font-size: 1.35rem;
  letter-spacing: 0.2px;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.schema {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 12px;
}

.card {
  padding: 10px;
}

.card h2 {
  margin: 0 0 8px 0;
  font-size: 1rem;
}

.control {
  margin-bottom: 8px;
}

.control label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.82rem;
  margin-bottom: 3px;
  line-height: 1.15;
}

.control span {
  color: var(--accent);
  font-weight: 700;
}

.control input {
  width: 100%;
}

.inline-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 8px;
  align-items: end;
}

/* Right-align inputs in the Arbeitspunkte "Gitter" pane */
.grid-controls .inline-control {
  grid-template-columns: 1fr auto;
  align-items: center;
}
.grid-controls .inline-control input,
.grid-controls .inline-control select {
  justify-self: end;
}

.grid-controls .inline-control .input-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}
.grid-controls .inline-control .input-row input {
  width: 80px;
}

.inline-control .field-label {
  display: block;
  margin: 0 0 3px 0;
  font-weight: 600;
  font-size: 0.82rem;
  line-height: 1.15;
}

.control input[type="number"] {
  height: 28px;
  padding: 3px 6px;
  font-size: 0.86rem;
}

.control input[type="range"] {
  height: 18px;
}

.param-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 7px;
  margin-bottom: 8px;
  background: #fff;
}

.param-group h3 {
  margin: 0 0 4px 0;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.param-subtext {
  margin: 0 0 6px 0;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: lowercase;
  line-height: 1.25;
}

.run {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #fff;
  background: linear-gradient(120deg, var(--accent), #0b4f4a);
  cursor: pointer;
}

.run:hover {
  filter: brightness(1.06);
}

.secondary {
  margin-top: 8px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.secondary:hover {
  background: #f8f7f2;
}

.metrics-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfbf5;
  padding: 6px;
  margin-bottom: 8px;
}

.metrics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.metrics-list-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 0;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  background: #fff;
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  white-space: normal;
  flex: 0 0 auto;
}

.metric .k {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 1px;
}

.metric .v {
  font-weight: 700;
  font-size: 0.84rem;
}
.metric .v .paren {
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--muted);
  margin-left: 6px;
}

.plot {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 6px;
  margin-top: 8px;
}

.plot-collapsible {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-top: 8px;
  overflow: hidden;
}

.plot-collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  user-select: none;
}

.plot-collapsible > summary::-webkit-details-marker {
  display: none;
}

.plot-collapsible > summary::before {
  content: "+";
  display: inline-block;
  width: 14px;
  margin-right: 6px;
  color: var(--accent);
  font-weight: 800;
}

.plot-collapsible[open] > summary::before {
  content: "-";
}

.plot-body {
  padding: 6px;
}

.plot h3 {
  margin: 0 0 6px 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 700;
}

svg {
  width: 100%;
  height: 220px;
  display: block;
  overflow: visible;
}

svg * {
  pointer-events: none;
}

.legend {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.legend i {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 3px;
  vertical-align: -1px;
  margin-right: 5px;
}

.stats-table {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
  font-size: 0.72rem;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.stats-table th,
.stats-table td {
  padding: 3px 5px;
  border-bottom: 1px solid #ece7db;
  text-align: right;
  white-space: nowrap;
}

.stats-table th:first-child,
.stats-table td:first-child {
  text-align: left;
}

.stats-table thead th {
  font-weight: 700;
  color: #465464;
  background: #f9f7f1;
}

.stats-table tbody tr:last-child td {
  border-bottom: 0;
}

.sig-chip {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: -1px;
}

.sig-chip.dashed {
  background: transparent;
  border: 2px dashed currentColor;
}

.note {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  border-left: 3px solid var(--accent-2);
  padding-left: 9px;
  line-height: 1.4;
}

.hover-info {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.2em;
}

@media (max-width: 980px) {
  .hero {
    margin-top: 8px;
    font-size: 0.8rem;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  svg {
    height: 200px;
  }
}

@media (max-width: 640px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
