/* Vorgangswerk - Produktoberfläche (Demo) */
@font-face { font-family: "Archivo"; src: url("fonts/archivo.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/fraunces.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("fonts/plexmono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("fonts/plexmono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --ink: #14213d;
  --ink-2: #2b3a5c;
  --copper: #c8782d;
  --copper-soft: #f6e6d4;
  --paper: #fbf8f3;
  --soft: #f3ede3;
  --line: #e4dbcc;
  --muted: #667085;
  --ok: #2f6b4f;
  --ok-soft: #e3efe8;
  --warn: #9a5b12;
  --warn-soft: #fbeedb;
  --bad: #a8402a;
  --bad-soft: #f7e3dd;
  --radius: 6px;
  --mono: "Plex Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Archivo", system-ui, sans-serif; font-size: 14px; color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: -0.01em; }

/* Demo-Hinweisleiste */
.demo-bar { background: var(--copper); color: #fff; font-size: 12px; padding: 6px 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.demo-bar a { color: #fff; font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.5); }
.demo-bar button { background: rgba(255,255,255,.16); border: 0; color: #fff; padding: 3px 10px; border-radius: 3px; cursor: pointer; font-size: 12px; }

/* Grundgerüst */
.shell { display: grid; grid-template-columns: 232px 1fr; height: calc(100vh - 30px); }
.side { background: var(--ink); color: #dfe3ec; display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; }
.brand { display: flex; align-items: center; gap: 9px; padding: 2px 6px 16px; color: #fff; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 5px; background: var(--copper); display: grid; place-items: center; font-family: "Fraunces"; font-weight: 700; font-size: 16px; color: #fff; }
.brand b { font-family: "Fraunces"; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; display: block; line-height: 1.05; }
.brand small { font-size: 10.5px; color: #aab3c5; letter-spacing: .04em; text-transform: uppercase; }
.side .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #8c96ab; padding: 14px 8px 6px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 5px; color: #dfe3ec; text-decoration: none; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.nav:hover { background: rgba(255,255,255,.06); }
.nav.on { background: rgba(255,255,255,.11); color: #fff; }
.nav svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.nav .count { margin-left: auto; font-family: var(--mono); font-size: 11px; background: var(--copper); color: #fff; border-radius: 9px; padding: 0 7px; line-height: 18px; }
.nav .count.zero { background: rgba(255,255,255,.12); }
.side .foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; color: #aab3c5; }
.side .foot .status { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; color: #dfe3ec; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #58b38a; box-shadow: 0 0 0 3px rgba(88,179,138,.18); }

.main { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.top { height: 56px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 22px; border-bottom: 1px solid var(--line); background: #fff; }
.top h1 { font-size: 16px; font-weight: 600; margin: 0; }
.top .crumb { color: var(--muted); font-size: 13px; }
.top .spacer { flex: 1; }
.mandant { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.mandant .logo { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); border: 1px solid var(--line); font-weight: 700; font-size: 11px; }
.mandant small { display: block; color: var(--muted); font-size: 11.5px; }
.view { flex: 1; overflow: auto; }

/* Kennzahlen */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 18px 22px 0; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi small { color: var(--muted); font-size: 12px; display: block; }
.kpi b { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--ok); margin-left: 6px; }

/* Posteingang: Liste + Detail */
.split { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 0; height: 100%; }
.list { border-right: 1px solid var(--line); background: #fff; overflow: auto; }
.list-head { position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 6px; z-index: 1; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 3px 10px; font-size: 12px; cursor: pointer; color: var(--ink-2); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.item { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.item:hover { background: var(--paper); }
.item.on { background: var(--soft); }
.item.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--copper); }
.item.done { opacity: .55; }
.ch { width: 30px; height: 30px; border-radius: 5px; background: var(--soft); display: grid; place-items: center; color: var(--ink-2); }
.ch svg { width: 15px; height: 15px; }
.item .who { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .subj { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.item .meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.item time { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 3px; background: var(--soft); color: var(--ink-2); white-space: nowrap; }
.tag.hoch { background: var(--bad-soft); color: var(--bad); }
.tag.mittel { background: var(--warn-soft); color: var(--warn); }
.tag.niedrig { background: var(--ok-soft); color: var(--ok); }
.tag.typ { background: #e8ebf3; color: var(--ink-2); }
.tag.erledigt { background: var(--ok-soft); color: var(--ok); }

.detail { overflow: auto; padding: 22px 26px 40px; }
.empty { height: 100%; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 40px; }
.msg-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.msg-head h2 { font-size: 19px; margin: 0 0 4px; font-weight: 600; letter-spacing: -0.01em; }
.msg-head .from { color: var(--muted); font-size: 13px; }
.orig { margin-top: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; white-space: pre-wrap; line-height: 1.55; font-size: 13.5px; }
.orig .att { display: inline-flex; gap: 6px; align-items: center; margin-top: 10px; font-size: 12px; background: var(--soft); padding: 4px 9px; border-radius: 4px; }

.ki { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; }
.ki-head { display: flex; align-items: center; gap: 10px; padding: 11px 16px; background: var(--ink); color: #fff; }
.ki-head .lbl { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: #f0c493; font-weight: 600; }
.ki-head .t { font-weight: 600; }
.ki-head .spacer { flex: 1; }
.ki-head .sec { font-family: var(--mono); font-size: 11px; color: #aab3c5; }
.steps { list-style: none; margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; background: var(--paper); }
.steps li { display: flex; gap: 9px; align-items: center; font-size: 13px; color: var(--ink-2); opacity: 0; transform: translateY(2px); transition: opacity .25s, transform .25s; }
.steps li.in { opacity: 1; transform: none; }
.steps li .ok { width: 16px; height: 16px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 10px; flex: none; }
.steps li.run .ok { background: transparent; border: 2px solid var(--copper); border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ki-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.ki-body > div { padding: 14px 16px; }
.ki-body > div + div { border-left: 1px solid var(--line); }
.ki h3 { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--copper); margin: 0 0 9px; }
.fields { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; margin: 0; }
.fields dt { color: var(--muted); }
.fields dd { margin: 0; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.fields dd .st { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 3px; }
.st.ok { background: var(--ok-soft); color: var(--ok); }
.st.fehlt { background: var(--bad-soft); color: var(--bad); }
.st.vorschlag { background: var(--warn-soft); color: var(--warn); }
.hints { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.hints li { font-size: 12.5px; padding: 7px 9px; border-radius: 4px; background: var(--warn-soft); color: #6d4210; line-height: 1.4; }
.draft { width: 100%; min-height: 190px; border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; line-height: 1.5; font-size: 13px; resize: vertical; background: var(--paper); }
.actions { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--paper); align-items: center; flex-wrap: wrap; }
.actions .note { font-size: 12px; color: var(--muted); margin-left: auto; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 7px 13px; cursor: pointer; font-weight: 500; font-size: 13px; }
.btn:hover { border-color: #cbbfab; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-2); }
.btn.copper { background: var(--copper); color: #fff; border-color: var(--copper); }
.btn[disabled] { opacity: .5; cursor: default; }
.target { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.target b { font-weight: 600; }

/* Tabellen + Karten für Zusatzansichten */
.pad { padding: 20px 22px 40px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.card + .card { margin-top: 14px; }
.card-h { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card-h h2 { font-size: 15px; margin: 0; font-weight: 600; }
.card-h .spacer { flex: 1; }
.card-b { padding: 14px 16px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--paper); }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.bar { height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--copper); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* Live-Test */
.live { max-width: 980px; }
.live textarea.in { width: 100%; min-height: 150px; border: 1px solid var(--line); border-radius: 4px; padding: 12px; line-height: 1.5; background: #fff; }
.live .row { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.live .src { font-size: 12px; color: var(--muted); }

.toast { position: fixed; right: 20px; bottom: 20px; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 5px; font-size: 13px; box-shadow: 0 6px 24px rgba(20,33,61,.25); transform: translateY(20px); opacity: 0; transition: .25s; z-index: 50; max-width: 360px; }
.toast.in { transform: none; opacity: 1; }

/* Einführungs-Overlay */
.intro { position: fixed; inset: 0; background: rgba(20,33,61,.55); display: grid; place-items: center; z-index: 60; padding: 20px; }
.intro-box { background: #fff; border-radius: 8px; max-width: 520px; width: 100%; overflow: hidden; }
.intro-box header { background: var(--ink); color: #fff; padding: 18px 22px; }
.intro-box header small { color: #f0c493; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; font-weight: 600; }
.intro-box header h2 { font-family: "Fraunces"; font-weight: 600; font-size: 24px; margin: 4px 0 0; letter-spacing: -0.01em; }
.intro-box .b { padding: 18px 22px; line-height: 1.55; }
.intro-box ol { padding-left: 18px; margin: 10px 0 0; }
.intro-box li { margin: 4px 0; }
.intro-box footer { padding: 0 22px 20px; display: flex; gap: 8px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; height: auto; }
  .side { flex-direction: row; overflow-x: auto; padding: 8px; }
  .side .sec, .side .foot, .brand small { display: none; }
  .brand { padding: 0 8px 0 2px; }
  .nav { width: auto; white-space: nowrap; }
  .split, .ki-body, .grid2, .grid3 { grid-template-columns: 1fr; }
  .ki-body > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .kpis { grid-template-columns: 1fr 1fr; }
  .list { max-height: 45vh; }
  .top .crumb, .mandant small { display: none; }
}
