/* cs-einmass – 3dtools-Designsystem (Navy / Blau / Rot), Schriften lokal */

@font-face { font-family: "Archivo"; font-weight: 600; font-display: swap; src: url("../vendor/fonts/archivo-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 700; font-display: swap; src: url("../vendor/fonts/archivo-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 800; font-display: swap; src: url("../vendor/fonts/archivo-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("../vendor/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("../vendor/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("../vendor/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --navy-950:#0B1123;--navy-900:#101A33;--navy-800:#1B2A4E;--navy-700:#2A3A63;--navy-600:#34467A;--navy-500:#42568E;
  --blue-800:#12386B;--blue-700:#1A4B8C;--blue-600:#1F5AA0;--blue-500:#0070C0;--blue-400:#1E93DE;--blue-300:#6DC3EF;--blue-200:#B4E0F7;--blue-100:#E4F2FB;
  --red-700:#9A0F13;--red-600:#B81018;--red-100:#FBE7E8;
  --grey-50:#F6F8FA;--grey-100:#EDF1F5;--grey-200:#DDE4EC;--grey-300:#C3CEDA;--grey-400:#9AA8B8;--grey-500:#6F7F92;--grey-600:#4E5D6E;--grey-700:#37444F;
  --green-600:#0E7C4A;--green-100:#E2F3EA;--amber-600:#B26A00;--amber-100:#FCF0DC;
  --lime-700:#61760B;--lime-100:#F3F9DC;

  --text-strong:var(--navy-900);--text-body:var(--grey-700);--text-muted:var(--grey-500);
  --border-subtle:var(--grey-200);--border-default:var(--grey-300);
  --shadow-1:0 1px 2px rgba(16,26,51,.06),0 0 0 1px rgba(16,26,51,.05);
  --shadow-2:0 2px 6px rgba(16,26,51,.08),0 0 0 1px rgba(16,26,51,.05);
  --shadow-3:0 10px 24px -8px rgba(16,26,51,.18),0 0 0 1px rgba(16,26,51,.05);
  --shadow-4:0 24px 56px -16px rgba(16,26,51,.28);
  --shadow-focus:0 0 0 3px rgba(0,112,192,.28);
  --ease:cubic-bezier(.2,.6,.2,1);
  --font-display:"Archivo","Helvetica Neue",Helvetica,Arial,sans-serif;
  --font-body:"IBM Plex Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
  --font-mono:"IBM Plex Mono","SFMono-Regular",Menlo,Consolas,monospace;
  --topbar-h:68px;
  --inspector-w:340px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body); font-size: 15px; line-height: 1.5; color: var(--text-body);
  background: var(--grey-100); -webkit-font-smoothing: antialiased;
  overflow: hidden; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
h1,h2,h3,h4 { font-family: var(--font-display); color: var(--text-strong); letter-spacing: -0.012em; line-height: 1.18; font-weight: 700; margin: 0; }
.mono, input.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ Kopfzeile */
.topbar {
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-700) 100%);
  color: #fff; display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.brand-mark { width: 26px; height: 26px; color: var(--blue-300); }
.steps { display: flex; gap: 4px; flex: 1; justify-content: center; height: 100%; }
.steps button {
  appearance: none; background: none; border: 0; color: rgba(255,255,255,.72);
  font: 600 15px var(--font-body); padding: 0 14px; height: 100%; cursor: pointer;
  border-bottom: 3px solid transparent; display: flex; align-items: center; gap: 8px;
  transition: color 140ms var(--ease), border-color 200ms var(--ease);
}
.steps button .num {
  width: 24px; height: 24px; border-radius: 999px; display: inline-grid; place-items: center;
  font: 500 12px var(--font-mono); background: rgba(255,255,255,.12);
}
.steps button.active { color: #fff; border-bottom-color: var(--blue-400); }
.steps button.active .num { background: var(--blue-500); }
.steps button.done .num { background: rgba(109,195,239,.35); }
.steps button:disabled { opacity: .45; cursor: not-allowed; }

/* ------------------------------------------------------------ Arbeitsfläche */
.work { display: flex; height: calc(100% - var(--topbar-h) - env(safe-area-inset-top)); }
.stage {
  position: relative; flex: 1; min-width: 0; overflow: hidden; background: var(--grey-100);
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.loupe {
  position: absolute; width: 168px; height: 168px; border-radius: 999px; pointer-events: none;
  box-shadow: var(--shadow-4), 0 0 0 3px #fff, 0 0 0 4px var(--navy-700); z-index: 5;
}

.empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; }
.empty[hidden] { display: none; }
.empty-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow-3); padding: 40px; max-width: 520px; text-align: center; }
.empty-icon { width: 48px; height: 48px; color: var(--blue-600); }
.empty-card h2 { font-size: 28px; margin: 12px 0 8px; }
.empty-card p { margin: 0 0 24px; color: var(--text-muted); }
.empty-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.paste-target {
  margin-top: 20px; border: 1px dashed var(--border-default); border-radius: 10px; padding: 14px;
  color: var(--text-muted); font-size: 13px; -webkit-user-select: text; user-select: text; outline: none;
}
.paste-target:focus { border-color: var(--blue-500); box-shadow: var(--shadow-focus); }

.hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 4;
  background: var(--navy-900); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-weight: 500; box-shadow: var(--shadow-3); max-width: calc(100% - 32px);
  display: flex; gap: 12px; align-items: center;
}
.hint[hidden] { display: none; }
.hint .btn { height: 32px; padding: 0 12px; font-size: 13px; }

.zoom { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 3; }
.btn-icon { width: 48px; height: 48px; padding: 0; background: #fff; box-shadow: var(--shadow-2); color: var(--navy-800); font-size: 24px; font-weight: 500; }
.btn-icon svg { width: 20px; height: 20px; }

.busy {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 4;
  background: #fff; border-radius: 999px; padding: 10px 18px; box-shadow: var(--shadow-3);
  display: flex; gap: 10px; align-items: center; font-weight: 500; color: var(--navy-800);
}
.busy[hidden] { display: none; }
.spinner { width: 16px; height: 16px; border-radius: 999px; border: 2px solid var(--blue-200); border-top-color: var(--blue-500); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ Inspektor */
.inspector {
  width: var(--inspector-w); flex: none; background: #fff; overflow-y: auto; -webkit-overflow-scrolling: touch;
  box-shadow: -1px 0 0 var(--border-subtle);
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
}
.inspector h3 { font-size: 22px; margin-bottom: 4px; }
.inspector .lead { color: var(--text-muted); font-size: 13px; margin: 0 0 16px; }
.eyebrow { font: 600 11px var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); margin: 20px 0 8px; }
.section + .section { margin-top: 20px; }

.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label { font-size: 13px; font-weight: 500; color: var(--grey-600); display: flex; justify-content: space-between; gap: 8px; }
.field label .tag { font: 500 11px var(--font-mono); color: var(--text-muted); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
input[type=text], input[type=number], input:not([type]) {
  height: 44px; width: 100%; border: 1px solid var(--border-default); border-radius: 6px; padding: 0 12px;
  font: 400 16px var(--font-body); color: var(--text-strong); background: #fff; outline: none;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
input.mono { font-size: 15px; }
input:focus { border-color: var(--blue-500); box-shadow: var(--shadow-focus); }
input.ocr { background: var(--blue-100); }

.btn {
  appearance: none; border: 0; border-radius: 6px; height: 48px; padding: 0 18px; cursor: pointer;
  font: 600 15px var(--font-body); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 140ms var(--ease), box-shadow 140ms var(--ease), transform 140ms var(--ease);
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(.985); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-lg { height: 56px; padding: 0 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; }
.btn-primary { background: var(--navy-700); color: #fff; }
.btn-primary:hover { background: var(--navy-800); }
.btn-accent { background: var(--blue-500); color: #fff; }
.btn-accent:hover { background: var(--blue-600); }
.btn-signal { background: var(--red-600); color: #fff; }
.btn-secondary { background: #fff; color: var(--navy-800); box-shadow: inset 0 0 0 1px var(--border-default); }
.btn-secondary:hover { background: var(--grey-50); box-shadow: inset 0 0 0 1px var(--grey-400); }
.btn-secondary.on { background: var(--blue-100); box-shadow: inset 0 0 0 2px var(--blue-500); color: var(--blue-700); }
.btn-ghost { background: none; color: var(--blue-600); padding: 0 8px; }
.btn-ghost-inv { background: rgba(255,255,255,.08); color: #fff; height: 40px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.btn-ghost-inv:hover { background: rgba(255,255,255,.14); }
.btn-danger-ghost { background: none; color: var(--red-600); padding: 0 8px; height: 36px; font-size: 13px; }
.stack { display: grid; gap: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.note { border-radius: 6px; padding: 10px 12px; font-size: 13px; line-height: 1.45; margin: 8px 0; }
.note strong { font-weight: 600; }
.note-warn { background: var(--amber-100); color: #6b4000; }
.note-danger { background: var(--red-100); color: var(--red-700); }
.note-info { background: var(--blue-100); color: var(--blue-800); }
.note-ok { background: var(--green-100); color: #0a5a36; }

.card { background: #fff; border-radius: 10px; box-shadow: var(--shadow-1); padding: 14px; margin-bottom: 12px; }
.card.selected { box-shadow: 0 0 0 2px var(--blue-500), var(--shadow-2); }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head h4 { font-size: 16px; flex: 1; }
.dot { width: 14px; height: 14px; border-radius: 999px; border: 3px solid currentColor; flex: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 13px; margin-top: 8px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; font-family: var(--font-mono); color: var(--text-strong); text-align: right; }

.metric { display: flex; align-items: baseline; gap: 8px; }
.metric .val { font: 500 28px var(--font-mono); color: var(--text-strong); }
.metric .unit { color: var(--text-muted); }

.gps-box { background: var(--grey-50); border-radius: 10px; padding: 14px; margin-top: 12px; }
.progress { height: 6px; border-radius: 999px; background: var(--grey-200); overflow: hidden; margin: 10px 0; box-shadow: inset 0 1px 2px rgba(16,26,51,.07); }
.progress > span { display: block; height: 100%; background: linear-gradient(135deg, var(--navy-800), var(--blue-600) 55%, var(--blue-300)); transition: width 320ms var(--ease); }

.kabel { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px 22px; padding-left: 12px; border-left: 2px dashed var(--grey-300); font-size: 13px; }
.kabel input { width: 96px; height: 40px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { height: 40px; border-radius: 999px; padding: 0 14px; background: var(--grey-50); border: 0; box-shadow: inset 0 0 0 1px var(--border-default); font: 600 14px var(--font-body); display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--navy-800); }
.chip.on { box-shadow: inset 0 0 0 2px var(--blue-500); background: var(--blue-100); }

.ref { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--border-subtle); }
.ref-head { display: flex; justify-content: space-between; align-items: baseline; }
.ref-head .d { font: 500 20px var(--font-mono); color: var(--text-strong); }

table.summary { width: 100%; border-collapse: collapse; font-size: 13px; }
table.summary th { font: 600 11px var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); text-align: left; padding: 6px 4px; background: var(--grey-50); }
table.summary td { padding: 8px 4px; border-top: 1px solid var(--border-subtle); vertical-align: top; }
table.summary td.num { font-family: var(--font-mono); text-align: right; }

details { margin-top: 12px; }
details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--blue-600); padding: 6px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 8px); opacity: 0; pointer-events: none;
  background: var(--navy-900); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow-4);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease); max-width: min(560px, 90vw); font-weight: 500;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  :root { --inspector-w: 300px; }
  .steps button { padding: 0 8px; font-size: 13px; }
  .brand span { display: none; }
}
@media (orientation: portrait) and (max-width: 1100px) {
  .work { flex-direction: column; }
  .inspector { width: 100%; height: 42%; box-shadow: 0 -1px 0 var(--border-subtle); }
  .stage { flex: 1; }
  .steps button { padding: 0 8px; }
}
.tag-auto { font: 600 11px var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--blue-700); background: var(--blue-100); border-radius: 4px; padding: 2px 6px; vertical-align: 2px; margin-left: 6px; }
.kabel-hint { margin: -8px 0 12px 36px; font-size: 12px; color: var(--text-muted); }
.name-select {
  appearance: none; -webkit-appearance: none; height: 40px; width: 100%;
  border: 1px solid var(--border-default); border-radius: 6px; padding: 0 28px 0 8px;
  font: 600 15px var(--font-body); color: var(--text-strong); background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232A3A63' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center;
  outline: none; cursor: pointer;
}
.name-select:focus { border-color: var(--blue-500); box-shadow: var(--shadow-focus); }
.card-head h4 { min-width: 0; }
.card-head .btn-danger-ghost { padding: 0 4px; }
