/*
 * ManufakturManager (MM) | assets/app.css | Version 0.8.0 | 2026-08-22
 * Ein Stylesheet für Desktop und Smartphone. Grundsatz: große Trefferflächen,
 * keine waagerechten Scrollbalken, Listenzeilen sind vollflächig anklickbar.
 */

/* ------------------------------------------------------------------ Farben */
:root {
  --bg: #f6f2ec;
  --surface: #ffffff;
  --surface-2: #fbf8f4;
  --ink: #2b2621;
  --ink-2: #5f564d;
  --muted: #857a6e;
  --line: #e4dbcf;
  --line-strong: #d3c6b5;
  --accent: #8a5030;
  --accent-soft: #f2e5db;
  --accent-ink: #ffffff;
  --ok: #2f7d4f;
  --ok-soft: #e4f2e9;
  --warn: #a86a12;
  --warn-soft: #fbeed6;
  --danger: #a83226;
  --danger-soft: #fbe4e1;
  --info: #2c6484;
  --info-soft: #e2eef5;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(43, 38, 33, .06), 0 6px 20px rgba(43, 38, 33, .06);
  --shadow-lift: 0 2px 6px rgba(43, 38, 33, .10), 0 12px 28px rgba(43, 38, 33, .10);
  --nav-w: 236px;
  --top-h: 60px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171411;
    --surface: #211d19;
    --surface-2: #262119;
    --ink: #f2ece4;
    --ink-2: #cabfb2;
    --muted: #9c9081;
    --line: #362f27;
    --line-strong: #4a4137;
    --accent: #d08a5e;
    --accent-soft: #3a2a1e;
    --accent-ink: #1d1713;
    --ok: #6fc493;
    --ok-soft: #1f3428;
    --warn: #e0a95a;
    --warn-soft: #3a2f1a;
    --danger: #ef8074;
    --danger-soft: #3c221f;
    --info: #7fb6d6;
    --info-soft: #1d2e39;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
    --shadow-lift: 0 2px 8px rgba(0, 0, 0, .5), 0 14px 30px rgba(0, 0, 0, .4);
  }
}

/* ------------------------------------------------------------------ Basis */
* { box-sizing: border-box; }

/*
 * Das hidden-Attribut muss jede eigene display-Regel schlagen. Ohne diese Zeile
 * bleiben ausgeblendete Felder sichtbar, sobald sie display:flex tragen.
 */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--accent); color: var(--accent-ink); padding: 10px 16px;
}
.skip-link:focus { left: 8px; top: 8px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ Kopfzeile */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  height: var(--top-h); padding: 0 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.brand-mark { font-size: 1.35rem; }
.brand-text { font-weight: 500; letter-spacing: -.01em; white-space: nowrap; }
.brand-text strong { font-weight: 750; }

.topsearch { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 520px; margin-left: auto; }
.topsearch input {
  width: 100%; min-width: 0; height: 40px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface-2); color: var(--ink); font-size: .95rem;
}
.topsearch input::placeholder { color: var(--muted); }

.topuser { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; height: 42px; padding: 0 8px;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--ink); font-size: 1.05rem; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.help-btn, .field-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--ink-2); font-size: .82rem; font-weight: 700; line-height: 1;
}
.help-btn { width: 34px; height: 34px; font-size: .95rem; }
.field-help { margin-left: 6px; vertical-align: middle; }
.help-btn:hover, .field-help:hover { background: var(--accent-soft); color: var(--accent); }

.usermenu { position: relative; }
.usermenu summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu-panel {
  position: absolute; right: 0; top: 46px; z-index: 80; width: 232px; padding: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lift);
}
.usermenu-panel a {
  display: block; padding: 9px 8px; border-radius: 8px;
  color: var(--ink); text-decoration: none;
}
.usermenu-panel a:hover { background: var(--surface-2); }
.usermenu-name { margin: 0; font-weight: 650; }
.usermenu-panel .version { margin: 8px 0 0; border-top: 1px solid var(--line); padding-top: 8px; }

/* ------------------------------------------------------------------ Navigation */
.nav-toggle { display: none; }
.burger, .burger::before, .burger::after {
  display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--ink); content: '';
}
.burger { position: relative; }
.burger::before { position: absolute; top: -6px; }
.burger::after { position: absolute; top: 6px; }

.shell { display: flex; align-items: flex-start; }

.nav {
  position: sticky; top: var(--top-h); flex: 0 0 var(--nav-w); width: var(--nav-w);
  height: calc(100vh - var(--top-h)); padding: 14px 10px; overflow-y: auto;
  border-right: 1px solid var(--line); background: var(--surface);
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; margin-bottom: 3px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav-icon { width: 22px; font-size: 1.05rem; text-align: center; }
.nav-label { flex: 1; }
.nav-badge {
  min-width: 22px; padding: 1px 7px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font-size: .75rem; font-weight: 700; text-align: center;
}
.nav-backdrop { display: none; }

.main { flex: 1; min-width: 0; padding: 20px clamp(12px, 3vw, 28px) 80px; }

/* ------------------------------------------------------------------ Seitenkopf */
.page-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.page-head h1 { margin: 0; flex: 1; min-width: 200px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-sub { margin: -6px 0 14px; color: var(--muted); }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips + .chips { padding-left: 8px; border-left: 1px solid var(--line-strong); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); text-decoration: none; font-size: .9rem; font-weight: 550; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip-count { opacity: .75; font-variant-numeric: tabular-nums; }

.inline-search { display: flex; gap: 6px; flex: 1; min-width: 190px; }
.inline-search input {
  flex: 1; min-width: 0; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--ink);
}

/* ------------------------------------------------------------------ Knöpfe */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------------------------ Karten */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.card-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: -4px 0 12px;
}
.card-head h2, .card-head h3 { margin: 0; flex: 1; min-width: 140px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat {
  display: block; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink);
}
.stat:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .87rem; }
.stat.alert .stat-value { color: var(--danger); }
.stat.warn .stat-value { color: var(--warn); }

/* ------------------------------------------------------------------ Listen */
.list { display: flex; flex-direction: column; gap: 8px; }

.listitem {
  display: grid; align-items: center; gap: 4px 14px;
  padding: 13px 15px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
  grid-template-columns: 1fr auto;
}
.listitem:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.listitem:active { transform: translateY(1px); }
.li-main { min-width: 0; }
.li-title { display: block; font-weight: 650; overflow-wrap: anywhere; }
.li-sub { display: block; color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.li-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; }
.li-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }

.empty {
  padding: 32px 18px; text-align: center; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* ------------------------------------------------------------------ Marker */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: .78rem; font-weight: 650; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.pill-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill-late { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.pill-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill-done { background: var(--surface-2); color: var(--muted); }

.flash {
  padding: 12px 14px; border-radius: var(--radius); margin-bottom: 14px;
  background: var(--ok-soft); color: var(--ok); font-weight: 550;
}
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash.warning { background: var(--warn-soft); color: var(--warn); }
.flash.info { background: var(--info-soft); color: var(--info); }

/* Gravur ist der teuerste Fehler. Sie wird überall deutlich hervorgehoben. */
.engraving {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px;
  margin: 10px 0; padding: 11px 14px;
  border-left: 5px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--ink);
}
.engraving .label { font-size: .74rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.engraving .text { font-size: 1.12rem; font-weight: 700; overflow-wrap: anywhere; }
.engraving.missing { border-left-color: var(--danger); background: var(--danger-soft); }
.engraving.missing .label, .engraving.missing .text { color: var(--danger); }

/* ------------------------------------------------------------------ Produktion */
.prod-card { border-left: 5px solid var(--line-strong); }
.prod-card.level-late { border-left-color: var(--danger); }
.prod-card.level-tight { border-left-color: var(--warn); }
.prod-card.level-ok { border-left-color: var(--ok); }
.prod-card.level-done { border-left-color: var(--muted); opacity: .82; }
.prod-card .card-head { align-items: flex-start; }
.prod-head-main { flex: 1; min-width: 160px; }

.prod-title { font-size: 1.16rem; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.prod-position {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 9px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.prod-item { padding: 10px 0; border-top: 1px dashed var(--line); }
.prod-item:first-of-type { border-top: 0; }
.prod-item-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.prod-item-no {
  min-width: 26px; height: 26px; border-radius: 7px; background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .82rem;
}
.prod-options { color: var(--ink-2); font-size: .92rem; overflow-wrap: anywhere; }

.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 12px; }
.step-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 58px; padding: 6px 4px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--ink-2); font: inherit; font-size: .78rem; font-weight: 600; text-align: center;
}
.step-btn .step-mark { font-size: 1.05rem; line-height: 1; }
.step-btn:hover { border-color: var(--accent); }
.step-btn.done { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.step-btn.next { border-color: var(--accent); border-width: 2px; color: var(--accent); }

/* ------------------------------------------------------------------ Formulare */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .field > label { font-size: .87rem; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.field .hint { font-size: .8rem; font-weight: 400; color: var(--muted); }
.span-2 { grid-column: span 2; }
.span-full { grid-column: 1 / -1; }

.check {
  display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer; font-weight: 550;
}
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.form-actions {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
}
.form-actions .spacer { flex: 1; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 14px; }
legend { padding: 0 6px; font-weight: 650; color: var(--ink-2); }

/* ------------------------------------------------------------------ Details */
.datalist { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 18px; }
.datalist div { min-width: 0; }
.datalist dt { color: var(--muted); font-size: .8rem; }
.datalist dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tab {
  padding: 9px 15px; border-radius: 999px; text-decoration: none;
  color: var(--ink-2); background: var(--surface); border: 1px solid var(--line-strong); font-weight: 600;
}
.tab.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.timeline { display: flex; flex-direction: column; gap: 10px; }
.timeline-item {
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong);
}
.timeline-item.dir-in { border-left-color: var(--info); }
.timeline-item.dir-out { border-left-color: var(--accent); }
.timeline-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 4px; }
.timeline-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ Recherche */
.research-box { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 14px; }
.research-status { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-weight: 550; }
.research-status[hidden] { display: none !important; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.suggestion {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line); margin-bottom: 7px;
}
.suggestion input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); }
.suggestion .s-label { font-size: .78rem; color: var(--muted); }
.suggestion .s-value { font-weight: 600; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ Hilfefenster */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(30, 25, 20, .55);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  position: relative; width: min(640px, 100%); max-height: 84vh; overflow-y: auto;
  padding: 22px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-lift);
}
.modal-close {
  position: absolute; top: 10px; right: 10px; width: 38px; height: 38px;
  border: 0; border-radius: 50%; background: var(--surface-2); color: var(--ink);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}
.help-purpose { font-weight: 600; }
.help-body ul { margin: 0 0 1em; padding-left: 1.15em; }
.help-body li { margin-bottom: .3em; }
.help-body h4 { margin: 1em 0 .3em; }

.manual-chapter { margin-bottom: 10px; }
.manual-chapter > summary {
  cursor: pointer; padding: 13px 15px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); font-weight: 650;
}
.manual-chapter[open] > summary { border-radius: var(--radius) var(--radius) 0 0; border-bottom-color: transparent; }
.manual-body {
  padding: 4px 16px 14px; border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius); background: var(--surface);
}
.manual-body h4 { margin: 14px 0 4px; }

/* ------------------------------------------------------------------ Anmeldung */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.login-wrap { width: min(420px, 100%); }
.login-card {
  padding: 30px 26px; border-radius: 20px; text-align: center;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lift);
}
.login-mark { font-size: 2.6rem; }
.login-card h1 { font-weight: 400; }
.login-card form { margin-top: 18px; text-align: left; display: flex; flex-direction: column; gap: 12px; }

/* ------------------------------------------------------------------ Smartphone */
@media (min-width: 900px) {
  .listitem.cols-4 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) auto auto; }
  .listitem.cols-3 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) auto; }
}

@media (max-width: 899px) {
  .nav-toggle { display: inline-flex; }
  .brand-text { display: none; }
  .topsearch { max-width: none; }

  .nav {
    position: fixed; top: var(--top-h); left: 0; z-index: 90;
    width: min(290px, 84vw); height: calc(100dvh - var(--top-h));
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: var(--shadow-lift);
  }
  body.nav-open .nav { transform: translateX(0); }
  body.nav-open .nav-backdrop {
    display: block; position: fixed; inset: var(--top-h) 0 0 0; z-index: 85;
    border: 0; background: rgba(30, 25, 20, .45);
  }
  body.nav-open { overflow: hidden; }

  .nav-item { padding: 14px 14px; font-size: 1.02rem; }

  .main { padding: 16px 12px 90px; }
  .page-head h1 { font-size: 1.28rem; }

  /* Listen werden zu Karten: alles untereinander, nichts läuft seitlich weg. */
  .listitem { grid-template-columns: 1fr; }
  .li-meta { justify-content: flex-start; margin-top: 7px; }

  /* Auf schmalen Geräten steht die Bezeichnung in einer eigenen Zeile,
     damit sie nicht um die Positionsnummer herumfließt. */
  .prod-head-main { order: 3; flex-basis: 100%; min-width: 0; }
  .prod-card .card-head .li-meta { order: 2; margin-left: auto; margin-top: 0; }
  .prod-position { order: 1; }

  .steps { grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .step-btn { min-height: 62px; font-size: .68rem; padding: 6px 2px; }

  .span-2 { grid-column: span 1; }
  .form-grid { grid-template-columns: 1fr; }
  .datalist { grid-template-columns: 1fr 1fr; }

  .form-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 380px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .datalist { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .nav, .form-actions, .steps, .chips { display: none !important; }
  .main { padding: 0; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ------------------------------------------------------------------ Maßangaben */
.dims { display: flex; gap: 6px; flex-wrap: wrap; }
.dims .dim { flex: 1 1 90px; min-width: 0; }
.dims .dim[hidden] { display: none; }
.dims input { width: 100%; }
