/* FilaCal – Design-Tokens und Layout im Stil der Apple Human Interface Guidelines.
   Farben über light-dark(): folgt dem System, außer html[data-theme] legt es fest. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  --bg: light-dark(#f2f2f7, #000000);
  --bg-elevated: light-dark(#ffffff, #1c1c1e);
  --fill: light-dark(rgba(118, 118, 128, 0.12), rgba(118, 118, 128, 0.24));
  --fill-selected: light-dark(#ffffff, #636366);
  --material: light-dark(rgba(249, 249, 249, 0.82), rgba(28, 28, 30, 0.78));
  --material-solid: light-dark(#f9f9f9, #1c1c1e);

  /* Farben an Apple angelehnt, aber so abgedunkelt, dass Text die WCAG-Mindestkontraste (4,5:1) erreicht */
  --label: light-dark(#000000, #ffffff);
  --label-2: light-dark(rgba(60, 60, 67, 0.75), rgba(235, 235, 245, 0.6));
  --label-3: light-dark(rgba(60, 60, 67, 0.3), rgba(235, 235, 245, 0.3)); /* nur Deko, nie für Text */
  --separator: light-dark(rgba(60, 60, 67, 0.29), rgba(84, 84, 88, 0.6));

  --accent: light-dark(#0066cc, #0a84ff);         /* Text und Links */
  --accent-fill: light-dark(#0066cc, #0071e3);    /* Flächen mit weißer Schrift */
  --accent-tint: light-dark(rgba(0, 102, 204, 0.12), rgba(10, 132, 255, 0.2));
  --on-accent: #ffffff;
  --tab-inactive: light-dark(#6e6e73, #8e8e93);
  --green: light-dark(#1e7b34, #30d158);
  --red: light-dark(#d70015, #ff453a);
  --orange: light-dark(#c93400, #ff9f0a);

  --radius: 12px;
  --radius-small: 9px;
  --tabbar-height: 50px;
  --sidebar-width: 248px;
  --content-max: 760px;

  --font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.41;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--radius-small);
  background: var(--accent-fill);
  color: var(--on-accent);
  font-weight: 600;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---------- Gerüst ---------- */
.content {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           calc(var(--tabbar-height) + 32px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.content:focus { outline: none; }

/* Handy: Navigation als Tab-Leiste unten */
.nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--separator);
}

.nav-brand { display: none; }

.nav-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: var(--tabbar-height);
  margin: 0;
  padding: 0 max(0px, env(safe-area-inset-left));
  list-style: none;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
  color: var(--tab-inactive);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.nav-item:hover { text-decoration: none; }
.nav-item[aria-current="page"] { color: var(--accent); }

.nav-icon { width: 26px; height: 26px; }

/* Ab Tablet: Seitenleiste links */
@media (min-width: 768px) {
  .shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
  }

  .nav {
    position: sticky;
    inset: auto;
    top: 0; /* nach inset, sonst setzt inset es wieder auf auto */
    height: 100vh;
    padding: calc(20px + env(safe-area-inset-top)) 12px 20px max(12px, env(safe-area-inset-left));
    border-top: 0;
    border-right: 0.5px solid var(--separator);
    overflow-y: auto;
  }

  .nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 18px;
    color: var(--label);
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  .nav-brand:hover { text-decoration: none; }
  .nav-brand-icon { width: 28px; height: 28px; color: var(--accent); }

  .nav-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    height: auto;
    padding: 0;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    height: 36px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--label);
    font-size: 15px;
    font-weight: 400;
  }
  .nav-item:hover { background: var(--fill); }
  .nav-item .nav-icon { width: 20px; height: 20px; color: var(--accent); }
  .nav-item[aria-current="page"] {
    background: var(--accent-tint);
    color: var(--label);
    font-weight: 600;
  }

  .content {
    padding: 44px 40px 40px;
  }
}

/* ---------- Typografie ---------- */
.page-header { margin-bottom: 24px; }

.large-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.022em;
}

.lead {
  margin: 0;
  color: var(--label-2);
  font-size: 17px;
}

.muted { margin: 0; color: var(--label-2); }

.hint {
  margin: 8px 0 0;
  color: var(--label-2);
  font-size: 13px;
  line-height: 1.38;
}

.section-header {
  margin: 32px 16px 7px;
  color: var(--label-2);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.38;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ---------- Listen (Inset Grouped) ---------- */
.list {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
}

.list-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 11px 16px;
  color: var(--label);
}
a.list-row:hover { text-decoration: none; background: var(--fill); }

.list-row + .list-row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 58px;
  border-top: 0.5px solid var(--separator);
}

.list-row-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}
.list-row-title { font-size: 17px; }
.list-row-subtitle { color: var(--label-2); font-size: 15px; line-height: 1.33; }

.list-row-icon {
  flex: none;
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.list-row-chevron {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--label-3);
}

.step-number {
  display: grid;
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Karten ---------- */
.card {
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
}

.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, filter 0.15s ease;
}
.button:hover { text-decoration: none; filter: brightness(1.06); }
.button:active { opacity: 0.7; }
.button:disabled { cursor: not-allowed; opacity: 0.4; filter: none; }

.button-primary { background: var(--accent-fill); color: var(--on-accent); }

.actions { margin-bottom: 8px; }
.actions .button { width: 100%; }

@media (min-width: 768px) {
  .actions .button { width: auto; min-width: 280px; }
}

/* ---------- Badge ---------- */
.badge {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--label-2);
  font-size: 12px;
  font-weight: 500;
}

/* ---------- Formular-Bausteine ---------- */
.field { margin: 0; padding: 0; border: 0; min-width: 0; }

.field-label {
  display: block;
  margin-bottom: 10px;
  padding: 0;
  font-size: 15px;
  font-weight: 600;
}

.segmented {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  padding: 2px;
  border-radius: var(--radius-small);
  background: var(--fill);
}

.segmented-option { position: relative; }

.segmented-option input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented-option span {
  display: block;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.segmented-option input:checked + span {
  background: var(--fill-selected);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
  font-weight: 600;
}

.segmented-option input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 1px;
}

/* ---------- Formulare ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form .field { display: flex; flex-direction: column; }
.form .field-label { margin-bottom: 6px; }
.form .hint { margin-top: 6px; }
.form > .button { align-self: stretch; }

@media (min-width: 768px) {
  .form > .button { align-self: flex-start; min-width: 220px; }
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  color: var(--label);
  font: inherit;
  font-size: 17px;
}
.input::placeholder { color: var(--label-3); }
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.file-input { padding: 9px 12px; font-size: 15px; }
.input-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; }

.input-group { display: flex; gap: 8px; align-items: stretch; }
.input-group .input { flex: 1; min-width: 0; }
.input-group .button { flex: none; }

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--red) 14%, transparent);
  color: var(--red);
  font-size: 15px;
  font-weight: 500;
}

/* Schalter im iOS-Stil */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  font-size: 17px;
  cursor: pointer;
}

.switch {
  flex: none;
  position: relative;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 999px;
  background: light-dark(#e9e9eb, #39393d);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background 0.2s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease;
}
.switch:checked { background: light-dark(#34c759, #30d158); }
.switch:checked::after { transform: translateX(20px); }

/* ---------- Buttons: weitere Varianten ---------- */
.button-secondary { background: var(--fill); color: var(--accent); }
.button-destructive { color: var(--red); }
.button-small { min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: 15px; }

.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.button-row form { margin: 0; }

.logout { margin-top: 32px; }
.logout .button { width: 100%; }

/* ---------- Banner (Kurzmeldungen) ---------- */
.banner {
  margin-bottom: 20px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
}
.banner-success { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--label); }
.banner-error { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--label); }
.banner-warning { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--label); }

/* ---------- Badges: Varianten ---------- */
.badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.badge-accent { background: var(--accent-tint); color: var(--accent); }
.badge-danger { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.badge-warning { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }

.muted-inline { color: var(--label-2); font-weight: 400; }

/* ---------- Aufklappbare Listenzeilen ---------- */
.list-item { position: relative; }
.list-item + .list-item::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 58px;
  z-index: 1;
  border-top: 0.5px solid var(--separator);
}

.disclosure > summary { list-style: none; cursor: pointer; }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary:hover { background: var(--fill); }
.disclosure-chevron { transition: transform 0.2s ease; }
.disclosure[open] .disclosure-chevron { transform: rotate(90deg); }

.disclosure-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 4px 16px 18px 58px;
}
.disclosure-body .form { gap: 8px; }
.disclosure-body .form > .button { align-self: flex-start; min-width: 0; }

@media (max-width: 480px) {
  .disclosure-body { padding-left: 16px; }
}

/* ---------- Zurück-Link ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 0 8px -6px;
  font-size: 17px;
}
.back-link svg { width: 22px; height: 22px; }

/* ---------- Allgemeine Helfer ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.page-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.page-header-row .large-title { margin: 0; }

.button-icon { gap: 6px; }
.button-icon svg { width: 18px; height: 18px; }

.banner-info { background: var(--accent-tint); color: var(--label); }
.hint-top { margin: -12px 0 20px; font-size: 15px; }

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
}
.select option { background: var(--bg-elevated); color: var(--label); }

.textarea { min-height: 96px; resize: vertical; line-height: 1.4; }
.input-number { font-variant-numeric: tabular-nums; }
.input[aria-invalid="true"] { outline: 2px solid var(--red); outline-offset: 0; }

.field-error { margin: 6px 0 0; color: var(--red); font-size: 13px; font-weight: 500; }

.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-pair .field { min-width: 0; }

.color-input {
  flex: none;
  width: 52px;
  height: 44px;
  padding: 4px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  cursor: pointer;
}
.color-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input::-webkit-color-swatch { border: 0; border-radius: 7px; }
.color-input::-moz-color-swatch { border: 0; border-radius: 7px; }

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.form-actions .button { flex: 1 1 200px; }
@media (min-width: 768px) { .form-actions .button { flex: 0 0 auto; min-width: 180px; } }

.filament-form > section .section-header { margin-top: 24px; }
.filament-form > section:first-of-type .section-header { margin-top: 0; }

/* ---------- Aufklappbare Karte (z. B. Drucker hinzufügen) ---------- */
.disclosure-card { margin-top: 12px; }
.disclosure-card-summary {
  list-style: none;
  color: var(--accent);
  font-weight: 500;
  cursor: pointer;
}
.disclosure-card-summary::-webkit-details-marker { display: none; }
.disclosure-card[open] .disclosure-card-summary { margin-bottom: 16px; }

/* ---------- Suche und Filter ---------- */
.filter-form { margin-bottom: 12px; }

.search {
  position: relative;
  display: block;
}
.search-icon {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 18px;
  height: 18px;
  color: var(--label-2);
  transform: translateY(-50%);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  color: var(--label);
  font: inherit;
  font-size: 17px;
}
.search-input::placeholder { color: var(--label-2); }
.search-input:focus { outline: 2px solid var(--accent); outline-offset: 0; }

.filters { margin-top: 10px; }
.filters-summary {
  display: inline-block;
  padding: 4px 0;
  color: var(--accent);
  font-size: 15px;
  cursor: pointer;
  list-style: none;
}
.filters-summary::-webkit-details-marker { display: none; }
.filters[open] .filters-summary { margin-bottom: 8px; }

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.filter { display: flex; flex-direction: column; min-width: 0; }
.filter .field-label { margin-bottom: 6px; font-size: 13px; color: var(--label-2); font-weight: 500; }
.filter .input { min-height: 38px; padding-top: 6px; padding-bottom: 6px; font-size: 15px; }
.filter.switch-row { flex-direction: row; align-self: end; font-size: 15px; }

.result-count { margin: 0 16px 7px; color: var(--label-2); font-size: 13px; }
.empty-inline { margin: 20px 16px; color: var(--label-2); text-align: center; }

/* ---------- Filament-Zeilen ---------- */
#filament-list > li { position: relative; }
#filament-list > li + li::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 58px;
  z-index: 1;
  border-top: 0.5px solid var(--separator);
}
#filament-list > li[hidden] + li::before { display: none; }

.filament-row { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
.filament-row .swatch { margin-top: 2px; }
.filament-row .list-row-chevron { align-self: center; }

.swatch { flex: none; width: 28px; height: 28px; }
.swatch-ring { fill: none; stroke: var(--label-3); stroke-width: 1; }
.swatch-large { width: 64px; height: 64px; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--label-2);
  font-size: 12px;
  font-weight: 500;
  text-decoration: line-through;
  text-decoration-color: var(--label-2);
}
.chip-ok {
  background: color-mix(in srgb, var(--green) 15%, transparent);
  color: var(--green);
  text-decoration: none;
}

/* ---------- Detailansicht ---------- */
.detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.detail-title { margin-bottom: 0; }

.value-row {
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
}
.value-label { color: var(--label); }
.value {
  color: var(--label-2);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.value-missing { color: var(--label-2); font-style: italic; }
.value-copy { cursor: pointer; }
.value-copy .value { color: var(--accent); font-weight: 500; }
.value-copy:hover { background: var(--fill); }
.value-copy:active { background: color-mix(in srgb, var(--fill) 200%, transparent); }

/* In Detail-Listen gehen Trennlinien bis zum linken Rand der Beschriftung */
.list .value-row + .value-row::before { left: 16px; }

.section-footer { margin: 7px 16px 0; }

.notes { white-space: pre-wrap; overflow-wrap: anywhere; }

.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.detail-actions > * { flex: 1 1 160px; }
.detail-actions form { display: flex; }
.detail-actions form .button { flex: 1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-height) + 20px + env(safe-area-inset-bottom));
  z-index: 60;
  padding: 10px 18px;
  border-radius: 999px;
  background: light-dark(rgba(30, 30, 32, 0.92), rgba(235, 235, 245, 0.92));
  color: light-dark(#fff, #000);
  font-size: 15px;
  font-weight: 500;
  transform: translateX(-50%);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
@media (min-width: 768px) {
  .toast { bottom: 32px; left: calc(50% + var(--sidebar-width) / 2); }
}

/* ---------- Flow-Rechner ---------- */
.measure-grid {
  display: grid;
  grid-template-columns: auto repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 8px;
}
.measure-col {
  color: var(--label-2);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
}
.measure-side { padding-right: 4px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.measure-input { min-width: 0; padding-left: 6px; padding-right: 6px; text-align: center; }
.measure-input.is-outlier {
  outline: 2px solid var(--orange);
  outline-offset: 0;
  background: color-mix(in srgb, var(--orange) 12%, var(--fill));
}

.measure-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 16px;
}

.link-button {
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.link-button-destructive { color: var(--red); }

.result-card { display: flex; flex-direction: column; gap: 10px; }
.result-main { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.result-label { font-size: 17px; font-weight: 600; }
.result-value {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.result-value.is-unusual { color: var(--orange); }

.result-details { display: grid; gap: 4px; margin: 0; }
.result-details div { display: flex; justify-content: space-between; gap: 12px; }
.result-details dt { color: var(--label-2); }
.result-details dd { margin: 0; font-variant-numeric: tabular-nums; }

.result-text { margin: 0; color: var(--label); }

.result-warnings { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.result-warnings:empty { display: none; }
.result-warning {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 15px;
}
.result-warning-warning { background: color-mix(in srgb, var(--orange) 16%, transparent); }
.result-warning-error { background: color-mix(in srgb, var(--red) 14%, transparent); }

/* ---------- Anleitung ---------- */
.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.guide-section .section-header { margin-top: 28px; }
.guide > :first-child .section-header,
.guide > .guide-section:first-child .section-header { margin-top: 0; }

.prose { line-height: 1.5; }
.prose p, .prose ul, .prose ol { margin: 0 0 12px; }
.prose > :last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.prose li::marker { color: var(--label-2); }
.prose strong { font-weight: 600; }

.step-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 !important;
  list-style: none;
  counter-reset: chain;
}
.step-chain li {
  margin: 0 !important;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  counter-increment: chain;
}
.step-chain li::before { content: counter(chain) ". "; }

.menu-path {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 7px;
  background: var(--fill);
  font-size: 15px;
  font-weight: 500;
}
.menu-path-sep { color: var(--label-2); }

.callout {
  margin: 16px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  line-height: 1.45;
}
.callout p, .callout ul { margin: 0; }
.callout ul { padding-left: 20px; }
.callout li + li { margin-top: 6px; }
.callout-tip { background: var(--accent-tint); }
.callout-important { background: color-mix(in srgb, var(--orange) 16%, transparent); }

.formula {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--fill);
  font-weight: 600;
  text-align: center;
}

.button-inline { margin-top: 4px; }

.table-wrap { margin: 0 -4px; overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.data-table th, .data-table td {
  padding: 8px 6px;
  border-bottom: 0.5px solid var(--separator);
  text-align: left;
  vertical-align: top;
}
.data-table thead th { color: var(--label-2); font-size: 13px; font-weight: 500; }
.data-table tbody tr:last-child th, .data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody th { font-weight: 600; white-space: nowrap; }

.mini-calc { gap: 14px; }
.mini-result { display: grid; gap: 6px; margin: 0; padding-top: 12px; border-top: 0.5px solid var(--separator); }
.mini-result > div { display: flex; justify-content: space-between; gap: 12px; }
.mini-result dt { color: var(--label-2); }
.mini-result dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.mini-result-main { color: var(--accent); font-size: 20px; }
.mini-note { margin: 0; color: var(--orange); font-size: 15px; }
.mini-note-info {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--label);
  line-height: 1.4;
}

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

.sketch { margin: 28px 0 0; }
.sketch svg {
  display: block;
  width: 100%;
  height: auto;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--label);
}
.sketch figcaption { margin: 7px 16px 0; color: var(--label-2); font-size: 13px; line-height: 1.38; }

/* Teile einer Anleitungsseite (z. B. Würfel-Methode / Alternative) */
.guide-part {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 40px 0 0;
  padding-top: 20px;
  border-top: 0.5px solid var(--separator);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  scroll-margin-top: 16px;
}
.guide-part-tag {
  padding: 2px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 15%, transparent);
  color: var(--green);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}
.guide-part-tag-alt { background: var(--fill); color: var(--label-2); }
.guide-part + .guide-section .section-header { margin-top: 16px; }

/* Farben in den Skizzen */
.sk-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sk-thin { fill: none; stroke: var(--label-2); stroke-width: 1.2; stroke-linecap: round; }
.sk-dash { fill: none; stroke: var(--label-2); stroke-width: 1.2; stroke-dasharray: 4 4; }
.sk-fill { fill: var(--fill); stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.sk-good { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.sk-bad { fill: none; stroke: var(--red); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.sk-warn { fill: none; stroke: var(--orange); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.sk-dot { fill: var(--accent); }
.sk-dot-bad { fill: var(--red); }
/* Groß genug, dass die Schrift auch verkleinert am Handy lesbar bleibt */
.sk-text { fill: currentColor; font-family: var(--font); font-size: 16px; }
.sk-text-2 { fill: var(--label-2); font-family: var(--font); font-size: 15px; }
.sk-text-good { fill: var(--green); font-family: var(--font); font-size: 16px; font-weight: 600; }
.sk-text-bad { fill: var(--red); font-family: var(--font); font-size: 16px; font-weight: 600; }
.sk-text-warn { fill: var(--orange); font-family: var(--font); font-size: 16px; font-weight: 600; }

@media (max-width: 480px) {
  .sketch svg { padding: 6px; }
}
.sk-hatch { fill: var(--fill); stroke: none; }
.sk-solid-good { fill: var(--green); }
.sk-solid-bad { fill: var(--red); }
.sk-solid-warn { fill: var(--orange); }
.sk-pattern { stroke-width: 12; stroke-linecap: butt; stroke-linejoin: miter; }
.sk-pattern-good { stroke: var(--green); }
.sk-pattern-bad { stroke: var(--red); stroke-linejoin: round; }
.sk-pattern-warn { stroke: var(--orange); }
.sk-rough { stroke: var(--red); }
.sk-hole { fill: var(--bg-elevated); stroke: var(--red); stroke-width: 1; }
.sk-arrowhead { fill: currentColor; }

.download-card { display: flex; align-items: flex-start; gap: 14px; }
.download-icon { flex: none; width: 32px; height: 32px; color: var(--accent); }
.download-link { font-weight: 600; }
.download-text .hint { margin-top: 4px; }

.sources { margin: 24px 16px 0; color: var(--label-2); font-size: 13px; line-height: 1.6; }

.step-nav { display: flex; gap: 10px; margin-top: 36px; }
.step-nav-link {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--label);
}
.step-nav-link:hover { text-decoration: none; background: color-mix(in srgb, var(--bg-elevated) 85%, var(--accent)); }
.step-nav-next { text-align: right; }
.step-nav-label { color: var(--accent); font-size: 13px; font-weight: 500; }
.step-nav-title { font-weight: 600; }
.step-nav-prev:only-child { flex: 0 1 50%; }

/* ---------- Kalibrier-Modus ---------- */
.cal-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}
.cal-progress-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 2px;
  border-radius: 10px;
  color: var(--label-2);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}
.cal-progress-item:hover { text-decoration: none; background: var(--fill); }
.cal-progress-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--fill);
  color: var(--label-2);
  font-size: 13px;
  font-weight: 600;
}
.cal-progress-dot svg { width: 16px; height: 16px; }
.cal-progress-item.is-done .cal-progress-dot { background: var(--green); color: #fff; }
.cal-progress-item.is-current { color: var(--label); }
.cal-progress-item.is-current .cal-progress-dot { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.cal-progress-item.is-current:not(.is-done) .cal-progress-dot { background: var(--accent-fill); color: var(--on-accent); }
.cal-progress-title { line-height: 1.2; overflow-wrap: anywhere; }

@media (min-width: 768px) {
  .cal-progress-item { font-size: 13px; }
}

.checklist { padding-left: 0 !important; list-style: none; }
.checklist li { position: relative; padding-left: 28px; }
.checklist li::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--label-3);
  border-radius: 50%;
}

.jump-link { display: inline-block; margin-top: 8px; font-size: 15px; }

.howto { margin-top: 4px; }
.howto-summary {
  display: inline-block;
  margin: 0 16px 16px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.howto-summary::-webkit-details-marker { display: none; }
.howto-summary::after { content: " ▾"; }
.howto:not([open]) .howto-summary::after { content: " ▸"; }

#ergebnis { scroll-margin-top: 16px; }
#ergebnis .section-header { margin-top: 32px; }

.cal-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 16px 0;
  font-size: 15px;
}

/* ---------- Bambu-Profil ---------- */
.profile-card { gap: 12px; }
.profile-for { margin: 0; font-weight: 600; }
.profile-card > .button { align-self: stretch; }
@media (min-width: 768px) { .profile-card > .button { align-self: flex-start; min-width: 240px; } }
.profile-steps { padding: 12px 14px; border-radius: 10px; background: var(--fill); line-height: 1.45; }
.profile-steps-heading { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.profile-steps ol { margin: 0 0 8px; padding-left: 20px; }
.profile-steps li + li { margin-top: 6px; }
.profile-upload { padding-top: 12px; border-top: 0.5px solid var(--separator); gap: 10px; }
.profile-card .callout { margin: 0; }
.chip.chip-profile { background: var(--accent-tint); color: var(--accent); text-decoration: none; }

/* ---------- Leerer Zustand ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 24px;
  color: var(--label-2);
  text-align: center;
}
.empty-state-icon { width: 56px; height: 56px; margin-bottom: 12px; color: var(--label-3); }
.empty-state p { margin: 0; }

/* ---------- Fußzeile ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 48px;
  color: var(--label-2);
  font-size: 13px;
}

/* ---------- Einstellungen des Geräts respektieren ---------- */
@media (prefers-reduced-transparency: reduce) {
  .nav {
    background: var(--material-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
