/* Markenpalette Sörensen Hydraulik:
   Gelbverlauf #FFE255 -> #FFBD39 als Akzent, #18181B als Textfarbe.
   Die Wortmarke ist schwarz+gelb und braucht hellen Untergrund. */
:root {
  --y1: #FFE255;
  --y2: #FFBD39;
  --ink: #18181B;
  --ink-70: #4b4b52;
  --muted: #71717a;
  --line: #e2e4e9;
  --line-soft: #eef0f4;
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent-grad: linear-gradient(100deg, var(--y1), var(--y2));
}

* { box-sizing: border-box; }

/* Muss vor allen display-Regeln stehen: .modal und .field-row setzen display:flex
   und würden das hidden-Attribut sonst aushebeln. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 14px/1.45 system-ui, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

kbd {
  font: inherit;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 4px;
}

/* ---------- Kopfzeile ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(24, 24, 27, .07);
  flex-wrap: wrap;
  /* Bleibt beim Scrollen der langen Ergebnisseite oben stehen. */
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 18px; min-width: 0; }
.brand-logo { height: 54px; width: auto; display: block; }

.brand-app {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-70);
  padding-left: 18px;
  border-left: 3px solid transparent;
  border-image: var(--accent-grad) 1;
}

@media (max-width: 700px) {
  .brand-logo { height: 34px; }
  .brand-app { font-size: 14px; padding-left: 12px; }
  /* Auf dem Telefon bräuchte die Kopfzeile mit umgebrochenen Knöpfen fast ein
     Fünftel der Bildschirmhöhe. Dauerhaft stehen bleiben lohnt das nicht. */
  .topbar { position: static; padding: 10px 14px; }
  .wrap { padding: 14px 14px 40px; }
}

.topnav { display: flex; gap: 6px; flex-wrap: wrap; }

.topnav button {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}
.topnav button:hover { border-color: var(--y2); background: #fffdf5; }
.topnav button.accent { background: var(--accent-grad); border-color: var(--y2); font-weight: 600; }

/* ---------- Layout ---------- */

.wrap { max-width: 1500px; margin: 0 auto; padding: 16px 22px 56px; }

/* Hauptreiter: Eingabe und Berechnung liegen übereinander, jeder volle Breite. */
.viewtabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid var(--line); }

.viewtabs button {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 10px 18px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.viewtabs button:hover { color: var(--ink); }
.viewtabs button.active { color: var(--ink); border-bottom-color: var(--y2); }

.tab-note { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; }

/* Beide Reiter nutzen die volle Breite bis zur Linie der Reiterleiste. */
.panel { min-width: 0; width: 100%; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
}

h2 { font-size: 18px; margin: 0 0 12px; font-weight: 700; letter-spacing: -.2px; }

.hint { color: var(--muted); margin-left: 12px; }

.placeholder { color: var(--muted); }
.placeholder p { margin: 0 0 14px; max-width: 52ch; }
.placeholder strong { color: var(--ink); }

button.primary {
  background: var(--accent-grad);
  color: var(--ink);
  border: 1px solid var(--y2);
  border-radius: 5px;
  padding: 9px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
button.primary:hover { filter: brightness(1.05); }

.link-btn {
  background: none; border: 0; color: var(--ink-70);
  cursor: pointer; padding: 10px 0 0; font-size: 13px;
  text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { color: var(--ink); }

/* ---------- Transporteinheit ---------- */

.group-select, .field-row input, .field-row select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 14px;
  background: var(--card);
  color: var(--ink);
}
.group-select { width: 100%; }

.unit-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.unit-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  cursor: pointer;
  background: var(--card);
  position: relative;
  text-align: left;
  font: inherit;
  color: inherit;
}
.unit-card:hover { border-color: var(--y2); }
.unit-card.selected { border-color: var(--y2); box-shadow: 0 0 0 2px rgba(255, 189, 57, .35); }

.unit-card .name { font-weight: 700; font-size: 13px; padding-right: 22px; }
.unit-card .dims { color: var(--muted); font-size: 11px; margin-top: 2px; }

.unit-card .mark {
  position: absolute; top: 9px; right: 9px;
  width: 17px; height: 17px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--card);
}
.unit-card.selected .mark { background: var(--accent-grad); border-color: var(--y2); }
.unit-card.selected .mark::after {
  content: "✓"; color: var(--ink); font-size: 12px; font-weight: 700;
  display: block; text-align: center; line-height: 15px;
}

.unit-art { display: block; width: 100%; height: auto; margin-top: 8px; }
/* Abgestimmt auf die Container-Dateien in desgin/transport: gleiche
   Strichfarbe, gleiche Strichstärke, gleiche helle Füllungen. */
.unit-art .ua-reifen { fill: #20242a; }
.unit-art .ua-felge  { fill: #eef1f5; }
.unit-art [class^="ua-"] {
  stroke: #20242a; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.unit-art .ua-body  { fill: #fff; }
.unit-art .ua-load  { fill: #f7f8fa; }
.unit-art .ua-top   { fill: #fff; }
.unit-art .ua-end   { fill: #eef1f5; }
.unit-art .ua-glass { fill: #dbe1ea; }
.unit-art .ua-frame { fill: #20242a; }
.unit-art .ua-leg   { fill: none; stroke-width: 3; }
.unit-art .ua-line  { stroke: #6b7280; stroke-width: 1; fill: none; }
.unit-art .ua-reifen, .unit-art .ua-felge { stroke-width: 2; }
/* Dekorative Elemente aus den Entwurfsdateien: ohne Kontur. */
.unit-art .ua-schatten { fill: #d9dde3; stroke: none; }
.unit-art .ua-akzent   { fill: #f0c84a; stroke: none; }

/* Eingezeichnete Einheiten heben die Ladefläche hervor. Bei Einheiten mit
   eigener Bilddatei geht das nicht - ein <img> ist von außen nicht
   einfärbbar -, deshalb übernimmt dort der Kartenhintergrund die Rolle. */
.unit-card.selected { background: #fffdf4; }
.unit-card.selected .unit-art .ua-load { fill: #FFEFC0; }
.unit-card.selected .unit-art .ua-top  { fill: #FFF7DF; }
.unit-card.selected .unit-art .ua-end  { fill: #F3D48A; }

.field-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.field-row.tight { margin-top: 12px; }
.field-row label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
.field-row input { width: 132px; }

/* ---------- Packliste ---------- */

.table-scroll { overflow-x: auto; }

/* Feste Spaltenbreiten: ohne sie schluckt die Inhalt-Spalte auf breiten
   Bildschirmen die gesamte zusätzliche Breite, während die Maßfelder eng
   bleiben. So bekommen erst die Zahlenfelder Platz, den Rest der Inhalt. */
table.packlist {
  border-collapse: collapse;
  width: 100%;
  min-width: 860px;
  table-layout: fixed;
}

table.packlist th {
  text-align: left; font-size: 12px; color: var(--muted);
  font-weight: 600; padding: 4px 5px;
}
table.packlist tr.units-row th { font-weight: 400; font-size: 11px; padding-top: 0; }
table.packlist td { padding: 3px 5px; }
table.packlist .c-nr { width: 26px; color: var(--muted); font-size: 12px; }

table.packlist input[type=text],
table.packlist input[type=number],
table.packlist select {
  width: 100%; padding: 6px 7px;
  border: 1px solid var(--line); border-radius: 5px;
  font-size: 13px; background: var(--card); color: var(--ink);
}
table.packlist input:focus, table.packlist select:focus,
.field-row input:focus, .group-select:focus, .modal-body input:focus, .modal-body select:focus {
  outline: 2px solid rgba(255, 189, 57, .55);
  outline-offset: 0;
  border-color: var(--y2);
}

/* Die Breiten stehen an den th, damit table-layout: fixed sie auswertet.
   Die Inhalt-Spalte hat bewusst keine Breite und nimmt den Rest auf. */
.c-nr { width: 32px; }
.c-qty { width: 84px; }
.c-type { width: 150px; }
.c-dim { width: 104px; }
.c-opt { width: 104px; white-space: nowrap; }

.swatch {
  width: 22px; height: 22px; border: 1px solid var(--line);
  border-radius: 4px; cursor: pointer; padding: 0; vertical-align: middle;
}

.opt-btn, .del-btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 4px;
  width: 24px; height: 24px; cursor: pointer; vertical-align: middle;
  line-height: 1; font-size: 13px; color: var(--ink-70);
}
.opt-btn:hover, .del-btn:hover { border-color: var(--y2); }
.opt-btn.marked { background: var(--accent-grad); border-color: var(--y2); color: var(--ink); }
.del-btn:hover { color: #c0392b; border-color: #c0392b; }

/* ---------- Optionen-Dialog ---------- */

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(24, 24, 27, .45); }

.modal-box {
  position: relative;
  background: var(--card);
  border-radius: 10px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 48px rgba(24, 24, 27, .28);
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.modal-x {
  border: 0; background: none; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--muted); padding: 0 4px;
}
.modal-x:hover { color: var(--ink); }

.modal-box.wide { width: min(920px, calc(100vw - 32px)); }

.modal-body { padding: 8px 16px 14px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--line);
  justify-content: flex-end; flex-wrap: wrap;
}
.modal-foot .spacer { flex: 1; }

button.ghost {
  background: var(--card); border: 1px solid var(--line); border-radius: 5px;
  padding: 7px 13px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer;
}
button.ghost:hover { border-color: var(--y2); background: #fffdf5; }

.modal-body textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line);
  border-radius: 5px; font: inherit; font-size: 13px; resize: vertical;
  background: var(--card); color: var(--ink);
}
.modal-body textarea:focus { outline: 2px solid rgba(255,189,57,.55); border-color: var(--y2); }

.req { color: #c0392b; font-style: normal; }
.feld-fehler { color: #c0392b; font-size: 12px; margin-top: 5px; }

.modal-info {
  margin: 12px 0 0; padding: 9px 11px; font-size: 12.5px;
  background: #fafbfc; border: 1px solid var(--line); border-radius: 6px; color: var(--ink-70);
}

/* Schrumpft und kürzt mit Auslassungspunkten, statt die Knöpfe umzubrechen. */
.speicherort {
  font-size: 11.5px; color: var(--muted); margin-right: auto;
  flex: 1 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.speicherort b { color: var(--ink); font-weight: 600; }

/* ---------- Vorlagenliste ---------- */

.vor-filter {
  display: flex; gap: 8px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.vor-filter input, .vor-filter select {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px;
  font: inherit; font-size: 13px; background: var(--card); color: var(--ink);
}
.vor-filter input { flex: 1; min-width: 190px; }
.vor-filter input:focus, .vor-filter select:focus {
  outline: 2px solid rgba(255,189,57,.55); border-color: var(--y2);
}

#vor-liste { max-height: min(52vh, 480px); }

.vor-eintrag {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 7px;
  padding: 10px 12px; margin-bottom: 8px;
}
.vor-eintrag:hover { border-color: var(--y2); }
.vor-haupt { flex: 1; min-width: 0; }
.vor-name { font-weight: 700; font-size: 14px; }
.vor-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.vor-meta b { color: var(--ink-70); font-weight: 600; }
.vor-beschreibung { font-size: 12.5px; color: var(--ink-70); margin-top: 5px; }

.vor-kennzahlen { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.vor-kennzahlen span {
  font-size: 11px; background: var(--line-soft); border-radius: 3px;
  padding: 2px 7px; color: var(--ink-70);
}

.vor-aktionen { display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; }
.vor-aktionen button { white-space: nowrap; }
.vor-loeschen { color: #c0392b; }
.vor-loeschen:hover { border-color: #c0392b; background: #fdf3f2; }

.vor-leer { color: var(--muted); padding: 22px 4px; text-align: center; }
.vor-leer p { margin: 0 0 10px; }

.opt-line {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft);
}
.opt-line:last-child { border-bottom: 0; }
.opt-line > span { font-size: 13px; }
.opt-line.stacked { display: block; }
.opt-line.stacked > span { display: block; margin-bottom: 5px; }
.opt-line input[type=text] { width: 100%; }
.opt-line input[type=number] { width: 84px; text-align: right; }
.opt-line input, .opt-line select {
  padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 5px; font-size: 13px; background: var(--card); color: var(--ink);
}

/* Ja/Nein-Schalter im Stil der Vorlage */
.toggle {
  min-width: 64px; padding: 4px 12px; border-radius: 4px;
  border: 1px solid var(--line); cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--ink); background: var(--line-soft);
}
.toggle[aria-pressed=true] { background: var(--accent-grad); border-color: var(--y2); }

/* ---------- Ergebnis ---------- */

.result-head h2 { margin-bottom: 10px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }

.stat {
  border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 11px; background: #fcfcfd;
}
.stat .k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat .v { font-size: 16px; font-weight: 700; margin-top: 2px; }
.stat .z { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.stat.alarm { border-color: #c0392b; background: #fdf4f3; }
.stat.alarm .v, .stat.alarm .z { color: #a5301f; }
.stat.alarm .z { font-weight: 600; }

.feld-hinweis { font-size: 11.5px; color: var(--muted); margin: 10px 0 0; max-width: 78ch; }
.feld-hinweis.top { margin: -6px 0 12px; }

/* ---------- Kurzmeldungen ---------- */

.toasts {
  position: fixed;
  top: 90px;
  right: 22px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 260px; max-width: 380px;
  padding: 11px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--y2);
  border-radius: 7px;
  box-shadow: 0 8px 24px rgba(24, 24, 27, .16);
  font-size: 13px;
  animation: toast-ein .18s ease-out;
}
.toast.weg { animation: toast-raus .25s ease-in forwards; }
.toast.fehler { border-left-color: #c0392b; }
.toast .inhalt { min-width: 0; }
.toast .t { font-weight: 700; }
.toast .s { color: var(--muted); margin-top: 2px; }
.toast .zeichen { font-size: 15px; line-height: 1.2; flex: 0 0 auto; }

@keyframes toast-ein  { from { opacity: 0; transform: translateX(16px); } }
@keyframes toast-raus { to   { opacity: 0; transform: translateX(16px); } }

@media (prefers-reduced-motion: reduce) {
  .toast, .toast.weg { animation: none; }
}

/* ---------- Geladene Vorlage ---------- */

.vorlage-box { border-left: 4px solid var(--y2); }
.vorlage-box .kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.vorlage-box .knoepfe { display: flex; gap: 8px; flex-wrap: wrap; }
.vorlage-box .knoepfe .primary { padding: 7px 14px; font-size: 13px; }
.vorlage-box .marke { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.vorlage-box h2 { margin: 2px 0 0; }
.vorlage-box .angaben { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.vorlage-box .angaben span {
  font-size: 12px; background: var(--line-soft); border-radius: 4px;
  padding: 3px 9px; color: var(--ink-70);
}
.vorlage-box .angaben b { color: var(--ink); font-weight: 600; }
.vorlage-box .beschreibung { font-size: 13px; color: var(--ink-70); margin: 9px 0 0; max-width: 80ch; }
.vorlage-box .geaendert {
  margin-top: 9px; font-size: 12px; color: #7a4c00;
  background: #fff8e6; border: 1px solid var(--y2);
  border-radius: 5px; padding: 7px 10px;
}

/* ---------- Achsdaten ---------- */

.schalter {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.schalter input { width: 16px; height: 16px; cursor: pointer; }

.achs-block {
  border: 1px solid var(--line); border-radius: 7px;
  padding: 10px 12px; margin-top: 10px;
}
.achs-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.achs-kopf select {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px;
  font: inherit; font-size: 12.5px; background: var(--card); color: var(--ink);
}

table.achs-tabelle { width: 100%; border-collapse: collapse; font-size: 13px; }
table.achs-tabelle th {
  text-align: left; font-size: 11px; color: var(--muted);
  font-weight: 600; padding: 2px 5px;
}
table.achs-tabelle th:not(:first-child) { text-align: right; }
table.achs-tabelle td { padding: 2px 5px; }
table.achs-tabelle td:first-child { font-size: 12.5px; white-space: nowrap; }
/* Kopf und Feld müssen bündig stehen, sonst liest man Werte in der falschen
   Spalte. Die Zellen sind breiter als die Eingabefelder. */
table.achs-tabelle th:not(:first-child),
table.achs-tabelle td:not(:first-child) { text-align: right; width: 24%; }
table.achs-tabelle input {
  width: 100%; max-width: 130px; padding: 5px 7px; text-align: right;
  border: 1px solid var(--line); border-radius: 5px;
  font: inherit; font-size: 13px; background: var(--card); color: var(--ink);
}
table.achs-tabelle input:focus { outline: 2px solid rgba(255,189,57,.55); border-color: var(--y2); }

.detail tr.ueber td { background: #fdf4f3; }
.detail tr.ueber b { color: #a5301f; }
.detail .rechnung.ok { color: #1d7a45; font-weight: 600; }
.mangelliste { margin: 0 0 16px; padding-left: 20px; font-size: 13px; line-height: 1.7; }

.warn {
  margin-top: 12px; padding: 10px 12px;
  background: #fff8e6; border: 1px solid var(--y2); border-radius: 6px;
  border-left-width: 4px;
}
.warn ul { margin: 6px 0 0; padding-left: 20px; }

.unit-list { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.unit-btn {
  text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: 7px; padding: 8px 12px; cursor: pointer; font: inherit; color: inherit;
}
.unit-btn.active { border-color: var(--y2); box-shadow: 0 0 0 2px rgba(255, 189, 57, .35); }
.unit-btn .t { font-weight: 700; font-size: 13px; }
.unit-btn .s { font-size: 11px; color: var(--muted); }

.viewbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tabs button {
  background: var(--card); border: 1px solid var(--line); border-radius: 5px;
  padding: 5px 11px; cursor: pointer; font-size: 13px; color: var(--ink);
}
.tabs button:hover { border-color: var(--y2); }
.tabs button.active { background: var(--accent-grad); border-color: var(--y2); font-weight: 600; }
.tabs .chk { font-size: 13px; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }

.tabs-line { border-bottom: 1px solid var(--line); padding-bottom: 10px; margin-bottom: 12px; }

canvas { width: 100%; display: block; background: var(--card); }
#canvas3d {
  cursor: grab;
  background: linear-gradient(#f2f4f8, #e4e8ee);
  border-radius: 6px;
  /* Ohne das behandelt der Browser die Wischgeste selbst und scrollt die
     Seite, statt die Ansicht zu drehen. */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
#canvas3d:focus { outline: 2px solid rgba(255, 189, 57, .6); }

/* Auf schmalen Geräten sind die Bedienknöpfe größer als der Zeigefinger. */
@media (max-width: 700px) {
  .viewbar .tabs button { padding: 8px 14px; }
  #btn-3d-rein, #btn-3d-raus { min-width: 44px; font-size: 16px; line-height: 1; }
}

.canvas-hint { font-size: 11.5px; color: var(--muted); margin: 8px 0 0; }

/* ---------- Detailtabellen ---------- */

.detail table { border-collapse: collapse; width: 100%; font-size: 13px; }
.detail th, .detail td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.detail th { background: #fafbfc; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; }
.detail td.num, .detail th.num { text-align: right; }
.detail .dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(24,24,27,.25); }
.detail dl { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 7px 18px; margin: 0; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; }
.detail h3 { font-size: 14px; margin: 16px 0 8px; }
.detail h3:first-child { margin-top: 0; }

.bar { background: var(--line-soft); border-radius: 4px; height: 16px; position: relative; overflow: hidden; max-width: 320px; }
.bar > i { display: block; height: 100%; background: var(--accent-grad); }
.bar > b { position: absolute; inset: 0; font-size: 11px; font-weight: 600; line-height: 16px; text-align: center; }

.group-box { border: 1px solid var(--line); border-radius: 7px; margin-bottom: 12px; overflow: hidden; }
.group-box > header {
  display: flex; align-items: baseline; gap: 8px;
  padding: 9px 12px; background: #fafbfc; border-bottom: 1px solid var(--line);
}
.group-box .count { font-size: 19px; font-weight: 700; }
.group-box .desc { font-size: 13px; color: var(--ink-70); }
.group-body { display: flex; gap: 14px; padding: 12px; align-items: flex-start; }
.stack-thumb { flex: 0 0 86px; width: 86px; height: auto; }
.group-body table { flex: 1; min-width: 0; }

.badge {
  display: inline-block; font-size: 10.5px; font-weight: 600;
  padding: 1px 6px; border-radius: 3px; background: var(--line-soft);
  color: var(--ink-70); margin-left: 5px;
}
.badge.crane { background: var(--accent-grad); color: var(--ink); }

.disclaimer { color: var(--muted); font-size: 11.5px; max-width: 980px; margin: 14px 0 0; }
.version { color: var(--muted); font-size: 11.5px; margin: 10px 0 0; }

/* ---------- Berechnungserklärung ---------- */

.detail .formel {
  margin: 0 0 8px;
  padding: 9px 12px;
  background: #fafbfc;
  border-left: 3px solid var(--y2);
  border-radius: 0 5px 5px 0;
  font-size: 14px;
}
.detail .formel-hinweis {
  display: block; margin-top: 5px;
  font-size: 12px; color: var(--muted);
}
.detail .rechnung { margin: 0 0 16px; font-size: 13px; line-height: 1.7; }
.detail .rechnung b { font-size: 14px; }
.detail tr.summe td { font-weight: 700; border-top: 2px solid var(--line); }

/* ---------- Druck ---------- */

.print-head, .print-only { display: none; }

/* Ausgelagert statt ausgeblendet: Ein Canvas in einem display:none-Element
   hat clientWidth 0 und liesse sich nicht zeichnen. Die feste Breite bildet
   die Druckbreite nach, damit die Seitenverhältnisse stimmen. */
#print-views { position: absolute; left: -100000px; top: 0; width: 1000px; }
#print-views .pv-row { display: flex; gap: 12px; }
#print-views .pv-row .pv { flex: 1; min-width: 0; }

@media print {
  @page { size: A4 landscape; margin: 11mm; }

  body { background: #fff; font-size: 10.5px; }
  /* #card-2d entfaellt: es zeigt nur den gewaehlten Blickwinkel und waere
     eine Dublette zu #print-views. */
  .topbar, .viewtabs, #panel-input, .modal, .link-btn, .viewbar .tabs, .unit-list,
  .canvas-hint, #result-empty, #detail-content, .tabs-line, #card-2d { display: none !important; }

  #print-views { position: static; left: auto; width: auto; }
  #print-views .pv { break-inside: avoid; margin-bottom: 6px; }
  #print-views .pv-row { gap: 8px; }
  /* Volle Seitenbreite statt der allgemeinen Hoehenbremse: Die Zeichnungen
     werden auf der Rampe gelesen und sollen gross sein. object-fit wuerde
     sie sonst innerhalb der Hoehe zentriert schrumpfen. */
  /* height mit !important, weil draw() die Hoehe als Inline-Stil setzt. Ohne
     das bliebe die gezeichnete Hoehe stehen, waehrend die Breite auf 100 %
     waechst - die Zeichnung waere um einige Prozent verzerrt. */
  #print-views canvas { max-height: none; object-fit: fill; height: auto !important; }

  .wrap { max-width: none; padding: 0; }

  /* Gedruckt wird immer das Ergebnis, auch wenn gerade die Eingabe offen ist.
     #result behält sein hidden, damit ein leeres Ergebnis nicht erzwungen wird. */
  #panel-result { display: block !important; }
  #result:not([hidden]) { display: block !important; }
  .panel { width: 100%; }

  .print-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 20px; padding-bottom: 8px; margin-bottom: 12px;
    border-bottom: 2px solid var(--y2);
  }
  .print-head img { height: 30px; width: auto; }
  .print-meta { text-align: right; }
  .print-title { font-size: 14px; font-weight: 700; }
  /* Zeilenumbruch aus dem Text erhalten: erste Zeile Vorlage, zweite Ladung. */
  #print-sub { color: #555; font-size: 10px; white-space: pre-line; }
  .toasts { display: none !important; }

  .print-only { display: block; }

  .card { border: 0; padding: 0; margin: 0 0 10px; break-inside: avoid; }
  .result-head h2 { font-size: 13px; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .stat { padding: 4px 7px; }
  .stat .v { font-size: 12px; }

  canvas { break-inside: avoid; max-height: 78mm; object-fit: contain; }
  #canvas3d { background: #fff; border: 1px solid var(--line); }

  .detail table, .print-only table { font-size: 9.5px; width: 100%; border-collapse: collapse; }
  .print-only th, .print-only td { border-bottom: 1px solid var(--line); padding: 3px 5px; text-align: left; }
  .print-only th { background: #f4f5f7; font-weight: 600; }
  .print-only td.num, .print-only th.num { text-align: right; }
  .print-only h3 { font-size: 11px; margin: 10px 0 5px; break-after: avoid; }
  .print-only .dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; border: 1px solid #999; }
  .print-only dl { display: grid; grid-template-columns: 190px 1fr; gap: 3px 12px; margin: 0; }
  .print-only .bar { max-width: 240px; height: 12px; }
  .print-only .bar > b { line-height: 12px; font-size: 9px; }
  .print-only dt { color: #555; }
  .print-only dd { margin: 0; }
  .print-only .page-break { break-before: page; }

  .warn { border: 1px solid #999; background: #fff; }
  .disclaimer { font-size: 8.5px; margin-top: 8px; }
}
