/* =========================================================================
   Cyberlab — Design-System
   Übernimmt die Bildsprache des Prozesshandbuchs (cyberlab.html) auf den
   Bildschirm: Papierton, harte Konturen, Prozessfarben, Mono-IDs.
   ========================================================================= */

:root {
  --paper: #FBFAF6;
  --card: #FFFFFF;
  --ink: #181B20;
  --mut: #5C6068;
  --line: #DCDAD2;
  --soft: #F1EFE8;

  --c41: #DD8A00;
  --sw: #4A4E57;
  --e6: #2B5CC8;
  --ecn2: #7A4FC9;
  --unknown: #8B8F98;

  --ok: #0E8A6D;
  --warn: #C2372E;
  --amber: #B87400;

  --radius: 8px;
  --radius-sm: 5px;
  --shadow: 3px 3px 0 var(--line);
  --mono: ui-monospace, "SFMono-Regular", "DejaVu Sans Mono", "Liberation Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

.mono, code { font-family: var(--mono); }
a { color: inherit; }

/* ------------------------------ Typografie ------------------------------ */

h1 { font-size: 1.75rem; line-height: 1.15; letter-spacing: -0.015em; }
h2 { font-size: 1.3rem; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.95rem; }

.eyebrow {
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mut);
  font-weight: 700;
}
.small { font-size: 0.8rem; color: var(--mut); }
.smaller { font-size: 0.72rem; color: var(--mut); }
.lead { font-size: 1.02rem; color: #31343B; }
.strong { font-weight: 700; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.muted { color: var(--mut); }
.danger { color: var(--warn); }
.success { color: var(--ok); }
.hidden { display: none !important; }

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

.app { display: flex; min-height: 100vh; }

.sidebar {
  flex: 0 0 232px;
  background: var(--ink);
  color: #EDECE6;
  padding: 20px 0 24px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar .brand { padding: 0 20px 18px; border-bottom: 1px solid #2C3037; }
.sidebar .brand .name { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.sidebar .brand .sub { font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; color: #8B8F98; margin-top: 2px; }
.sidebar nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  color: #C7C9CE; text-decoration: none; font-size: 0.88rem;
}
.sidebar nav a:hover { background: #24282F; color: #fff; }
.sidebar nav a.on { background: var(--paper); color: var(--ink); font-weight: 700; }
.sidebar nav a .ico { width: 18px; text-align: center; opacity: 0.9; }
.sidebar nav a .badge {
  margin-left: auto; background: var(--warn); color: #fff;
  font-size: 0.68rem; font-weight: 700; border-radius: 99px; padding: 0 6px; min-width: 18px; text-align: center;
}
.sidebar nav .sep { height: 1px; background: #2C3037; margin: 10px 12px; }
.sidebar nav .grouplabel { font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase; color: #6D7178; padding: 12px 12px 4px; }
.sidebar .who { padding: 12px 20px 0; border-top: 1px solid #2C3037; font-size: 0.78rem; color: #A7ABB2; }
.sidebar .who b { color: #fff; display: block; font-size: 0.86rem; }
.sidebar .who button {
  margin-top: 8px; background: none; border: 1px solid #43484F; color: #C7C9CE;
  border-radius: var(--radius-sm); padding: 4px 10px; font-size: 0.76rem; cursor: pointer; font-family: inherit;
}
.sidebar .who button:hover { border-color: #6D7178; color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--paper);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 1.25rem; }
.topbar .spacer { flex: 1; }
.content { padding: 24px 28px 64px; max-width: 1320px; width: 100%; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }

@media (max-width: 1080px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { position: static; height: auto; flex: none; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar nav .grouplabel, .sidebar nav .sep { display: none; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
}

/* ------------------------------ Karten ------------------------------ */

.card {
  background: var(--card);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card.plain { border: 1px solid var(--line); box-shadow: none; }
.card.flat { box-shadow: none; }
.card > .cardhead {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: -18px -20px 14px; padding: 12px 20px;
  border-bottom: 1.5px solid var(--ink); background: var(--soft);
  border-radius: var(--radius) var(--radius) 0 0;
}
.card > .cardhead h3 { font-size: 1rem; }

.kpi { padding: 14px 16px; }
.kpi .label { font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mut); font-weight: 700; }
.kpi .value { font-size: 1.9rem; font-weight: 700; line-height: 1.1; margin-top: 4px; letter-spacing: -0.02em; }
.kpi .hint { font-size: 0.76rem; color: var(--mut); margin-top: 2px; }
.kpi.alert { border-color: var(--warn); }
.kpi.alert .value { color: var(--warn); }

/* ------------------------------ Chips & Pills ------------------------------ */

.chip {
  display: inline-block; padding: 1px 8px; border-radius: 99px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; color: #fff; vertical-align: middle;
}
.chip.C41 { background: var(--c41); }
.chip.BW { background: var(--sw); }
.chip.E6 { background: var(--e6); }
.chip.ECN2 { background: var(--ecn2); }
.chip.UNKNOWN { background: var(--unknown); }
.chip.line { background: none; color: var(--ink); border: 1px solid var(--ink); }

.st {
  display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.03em;
  padding: 1px 8px; border-radius: 99px; border: 1px solid; white-space: nowrap;
}
.st.done { color: var(--ok); border-color: var(--ok); background: #EAF6F1; }
.st.run { color: var(--amber); border-color: var(--c41); background: #FBF3E3; }
.st.wait { color: var(--mut); border-color: var(--line); background: var(--soft); }
.st.err { color: var(--warn); border-color: var(--warn); background: #FBEBE9; }
.st.info { color: var(--e6); border-color: var(--e6); background: #EAF0FC; }

.tag {
  display: inline-block; font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--mut); border: 1px solid var(--line); border-radius: 99px; padding: 0 7px; background: var(--soft);
}

/* ------------------------------ Tabellen ------------------------------ */

table { width: 100%; border-collapse: collapse; }
th {
  font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; text-align: left;
  color: var(--mut); border-bottom: 1.5px solid var(--ink); padding: 8px 10px; font-weight: 700; white-space: nowrap;
}
td { border-bottom: 1px solid var(--line); padding: 9px 10px; vertical-align: middle; font-size: 0.88rem; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--soft); }
tbody tr.dim td { opacity: 0.5; }
table.dense td { padding: 6px 10px; font-size: 0.84rem; }
table.dense th { padding: 6px 10px; }
.tablewrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }

/* ------------------------------ Formulare ------------------------------ */

.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--mut); margin-bottom: 4px; font-weight: 700;
}
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="month"], input[type="date"], select, textarea {
  width: 100%; font-family: inherit; font-size: 0.9rem; color: var(--ink);
  border: 1.2px solid var(--ink); border-radius: var(--radius-sm);
  padding: 8px 10px; background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(24, 27, 32, 0.12); }
input:disabled, select:disabled { background: var(--soft); color: var(--mut); }
input.mono { font-family: var(--mono); }
textarea { min-height: 70px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.inline-input { display: inline-block; width: auto; min-width: 80px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  background: var(--ink); color: #fff; border: 1.2px solid var(--ink);
  border-radius: var(--radius-sm); padding: 8px 16px;
  font-family: inherit; font-size: 0.86rem; font-weight: 700; cursor: pointer; text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: #2C3037; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--ink); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { background: var(--warn); border-color: var(--warn); }
.btn.danger:hover { background: #A82C24; }
.btn.ghost.danger { background: #fff; color: var(--warn); border-color: var(--warn); }
.btn.ghost.danger:hover { background: #FBEBE9; }
.btn.big { padding: 11px 22px; font-size: 0.95rem; }
.btn.sm { padding: 4px 10px; font-size: 0.76rem; }
.btn.block { width: 100%; }

.radios { display: flex; flex-wrap: wrap; gap: 8px; }
.radios label {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 1.2px solid var(--line); border-radius: var(--radius-sm); padding: 7px 12px;
  font-size: 0.86rem; background: #fff;
}
.radios label:hover { border-color: var(--ink); }
.radios label.on { border-color: var(--ink); background: var(--soft); box-shadow: inset 0 0 0 1px var(--ink); font-weight: 700; }
.radios input { display: none; }
.radios label.disabled { opacity: 0.35; cursor: not-allowed; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.86rem; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }

/* ------------------------------ Callouts ------------------------------ */

.note {
  border-left: 3px solid var(--ink); background: var(--soft);
  padding: 10px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 0.86rem;
}
.note.warn { border-left-color: var(--warn); background: #FBEBE9; }
.note.ok { border-left-color: var(--ok); background: #EAF6F1; }
.note.info { border-left-color: var(--e6); background: #EAF0FC; }
.note b.t { display: block; font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 3px; }

/* ------------------------------ Wizard ------------------------------ */

.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.steps s {
  flex: 1; text-decoration: none; text-align: center; font-size: 0.7rem;
  letter-spacing: 0.08em; text-transform: uppercase; padding: 7px 0;
  border-radius: 99px; background: var(--soft); color: var(--mut); border: 1px solid var(--line); font-weight: 700;
}
.steps s.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.steps s.done { background: #fff; color: var(--ok); border-color: var(--ok); }

.tilegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
.tile {
  border: 1.2px solid var(--ink); border-radius: var(--radius); padding: 12px 10px 10px;
  text-align: center; background: #fff; user-select: none;
}
.tile.sel { background: var(--soft); box-shadow: inset 0 0 0 1.5px var(--ink); }
.tile.dashed { border-style: dashed; }
.tile .art { height: 54px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.tile .lbl { font-size: 0.78rem; font-weight: 700; line-height: 1.3; min-height: 2.6em; }
.tile .cnt { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 8px; }
.tile .cnt b { font-size: 1.15rem; min-width: 22px; }
.pm {
  width: 26px; height: 26px; border: 1.2px solid var(--ink); border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; background: #fff; cursor: pointer; font-family: inherit; color: var(--ink);
}
.pm:hover { background: var(--soft); }
.pm:disabled { opacity: 0.3; cursor: not-allowed; }

/* Film-Illustrationen (Patrone 135 / Rolle 120) */
.can { width: 30px; height: 42px; border-radius: 4px; position: relative; display: inline-block; }
.can::before { content: ""; position: absolute; top: -7px; left: 10px; width: 11px; height: 7px; background: #2C2F35; border-radius: 2px 2px 0 0; }
.can::after { content: ""; position: absolute; top: 10px; left: 0; right: 0; height: 20px; background: #fff; opacity: 0.88; }
.roll { width: 50px; height: 40px; border-radius: 5px; position: relative; display: inline-block; }
.roll::after { content: ""; position: absolute; top: 0; bottom: 0; left: 18px; width: 15px; background: #fff; opacity: 0.88; }
.qmark { font-size: 1.8rem; font-weight: 700; color: var(--mut); }

/* Filmstreifen-Motiv */
.strip { display: flex; gap: 5px; }
.strip i { display: block; width: 22px; height: 15px; border-radius: 3px; background: var(--ink); }

/* ------------------------------ Timeline ------------------------------ */

.timeline { display: flex; flex-direction: column; gap: 0; }
.tl { display: flex; gap: 14px; position: relative; padding-bottom: 14px; }
.tl::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 1.5px; background: var(--line); }
.tl:last-child { padding-bottom: 0; }
.tl:last-child::before { display: none; }
.tl .dot {
  flex: 0 0 23px; height: 23px; border-radius: 50%; background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 0.66rem; font-weight: 700; z-index: 1;
}
.tl .dot.wait { background: #fff; color: var(--mut); border: 1.5px solid var(--line); }
.tl .dot.err { background: var(--warn); }
.tl .dot.ok { background: var(--ok); }
.tl .body { flex: 1; min-width: 0; padding-top: 1px; }
.tl .body b { display: block; font-size: 0.88rem; }
.tl .body span { color: var(--mut); font-size: 0.78rem; }

/* ------------------------------ Modal & Toast ------------------------------ */

.modal-bg {
  position: fixed; inset: 0; background: rgba(24, 27, 32, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
}
.modal {
  background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--radius);
  box-shadow: 6px 6px 0 rgba(24, 27, 32, 0.2); width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto;
}
.modal.wide { max-width: 900px; }
.modal .mhead { padding: 14px 20px; border-bottom: 1.5px solid var(--ink); background: var(--soft); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal .mbody { padding: 20px; }
.modal .mfoot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal .x { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--mut); line-height: 1; font-family: inherit; }

#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: min(440px, calc(100vw - 36px)); }
.toast {
  background: var(--ink); color: #fff; border-radius: var(--radius-sm); padding: 11px 15px;
  font-size: 0.86rem; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); animation: toastin 0.16s ease-out;
}
.toast.err { background: var(--warn); }
.toast.ok { background: var(--ok); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------ Login ------------------------------ */

.loginwrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.loginbox { width: 100%; max-width: 420px; }
.loginbox .brandline { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.demo-users { margin-top: 18px; font-size: 0.8rem; }
.demo-users button {
  display: flex; width: 100%; justify-content: space-between; gap: 10px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px 11px; margin-bottom: 5px; cursor: pointer; font-family: inherit; font-size: 0.8rem; text-align: left;
}
.demo-users button:hover { border-color: var(--ink); background: var(--soft); }

/* ------------------------------ Barcode ------------------------------ */

.barcode { display: block; width: 100%; height: 44px; }
.barcode-label { font-family: var(--mono); font-weight: 700; text-align: center; letter-spacing: 0.06em; }

/* ------------------------------ Diverses ------------------------------ */

.scroller { max-height: 420px; overflow-y: auto; }
.empty { text-align: center; padding: 34px 20px; color: var(--mut); font-size: 0.88rem; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progressbar { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progressbar > i { display: block; height: 100%; background: var(--ok); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.pricebox { border: 1.2px solid var(--ink); border-radius: var(--radius); padding: 14px 16px; background: #fff; }
.pricebox .total { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0; }
