[hidden] { display: none !important; }
:root {
  --bg: #0b1020; --bg2: #0f1529; --panel: #141b31; --panel2: #1a2340; --line: #26304f; --text: #e8ecf8; --muted: #8d97b5;
  --accent: #3ee6ff; --violet: #a78bfa; --web: #38bdf8; --trading: #f5c451; --video: #f472b6; --quality: #34d399; --management: #a78bfa;
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --radius: 12px;
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: .2px; }
h2 { font-size: 16px; margin: 22px 0 10px; color: #cfd6ee; }
h3 { font-size: 14px; margin: 0 0 6px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); min-height: 1.2em; }
code, pre { font-family: var(--mono); font-size: 12px; }
pre { white-space: pre-wrap; word-break: break-word; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 60vh; overflow: auto; }

/* Layout */
#app { display: grid; grid-template-columns: 232px 1fr; height: 100%; }
#nav { background: linear-gradient(180deg, #0d1328, #0a0f1f); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; }
#nav nav { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; flex: 1; overflow: auto; }
#nav nav a { color: #c3cbe3; padding: 9px 10px; border-radius: 9px; display: flex; align-items: center; gap: 10px; }
#nav nav a i { font-style: normal; width: 18px; text-align: center; opacity: .8; }
#nav nav a:hover { background: var(--panel); }
#nav nav a.active { background: linear-gradient(90deg, rgba(62,230,255,.16), rgba(167,139,250,.08)); color: #fff; box-shadow: inset 2px 0 0 var(--accent); }
.nav-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); }
.brand { display: flex; gap: 10px; align-items: center; }
.brand strong { display: block; font-size: 15px; }
.brand span { display: block; font-size: 11px; color: var(--muted); }
#view { overflow: auto; padding: 22px 26px 40px; outline: none; position: relative; }
#view.full { padding: 0; overflow: hidden; }
#tabbar { display: none; }
.badge { background: var(--bad); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 600; margin-left: auto; }

/* Bausteine */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card.click { cursor: pointer; transition: border-color .15s, transform .15s; }
.card.click:hover { border-color: #3a4775; transform: translateY(-1px); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 6px 0 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi b { display: block; font-size: 22px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 12px; }
.bar { height: 6px; background: var(--bg2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }

.btn { appearance: none; border: 1px solid var(--line); background: var(--panel2); color: var(--text); padding: 8px 14px; border-radius: 9px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #46548a; }
.btn.primary { background: linear-gradient(135deg, #22b8d6, #7c5cf0); border: 0; color: #fff; font-weight: 600; }
.btn.danger { border-color: #6b2b36; color: #ffb4b4; }
.btn.ok { border-color: #1f6b52; color: #9ff0cf; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font: inherit; }
input[type=checkbox] { width: auto; }
textarea { min-height: 80px; resize: vertical; }
label { display: block; color: var(--muted); font-size: 12px; margin: 8px 0; }
label > input, label > select, label > textarea { margin-top: 4px; color: var(--text); font-size: 14px; }
.form-grid { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 8px; border-bottom: 1px solid #1c2440; vertical-align: top; }
.table tr.click { cursor: pointer; } .table tr.click:hover td { background: #151d36; }
.scroll-x { overflow-x: auto; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: #1d2747; color: #c9d2ee; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-working, .st-running { color: var(--accent); } .st-talking { color: var(--warn); } .st-waiting, .st-waiting_dependency, .st-review { color: var(--violet); }
.st-idle, .st-queued { color: #9aa4c4; } .st-paused, .st-waiting_approval { color: #c4a7ff; } .st-error, .st-failed { color: var(--bad); }
.st-done, .st-approved { color: var(--ok); } .st-cancelled, .st-rejected { color: #6b7493; } .st-pending { color: var(--warn); }
.dept { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.test-tag { background: #4b3a10; color: #ffd875; border-radius: 6px; font-size: 11px; padding: 1px 6px; }

.avatar-badge { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #0b1020; flex: none; position: relative; }
.avatar-badge::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--ring, transparent); }

.feed { display: flex; flex-direction: column; gap: 8px; }
.msg { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.msg header { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; flex-wrap: wrap; }
.msg header b { color: var(--text); }
.msg.high { border-color: #5b4a1b; }
.msg .body { white-space: pre-wrap; word-break: break-word; }
.msg.mine { background: #16233f; }
.ev { display: grid; grid-template-columns: 74px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid #1a2240; font-size: 13px; }
.ev time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.ev.high { color: #ffe3a3; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 12px 0; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 8px 12px; cursor: pointer; font: inherit; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: #fff; border-bottom-color: var(--accent); }
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.notice { background: #12233a; border: 1px solid #1f4266; color: #bfe3ff; border-radius: 10px; padding: 10px 12px; margin: 8px 0 14px; }
.notice.warn { background: #2a2210; border-color: #5a4515; color: #ffe1a1; }
.md h1, .md h2, .md h3 { margin: 14px 0 6px; } .md ul { padding-left: 20px; } .md p { margin: 6px 0; }

/* Drawer & Modal */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg2); border-left: 1px solid var(--line); z-index: 40; display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(0,0,0,.45); }
.drawer-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; }
.drawer-body { flex: 1; overflow: auto; padding: 4px 18px 18px; }
.drawer-foot { border-top: 1px solid var(--line); padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 8px; }
.modal { position: fixed; inset: 0; background: rgba(4,7,16,.72); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; width: min(980px, 100%); max-height: 92vh; display: flex; flex-direction: column; }
.modal-box.narrow { width: min(520px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; overflow: auto; }
.preview-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.x { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; max-width: 360px; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.err { border-color: #6b2b36; }

/* Büro */
.office { position: absolute; inset: 0; }
.office canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.office-ui { position: absolute; pointer-events: none; inset: 0; }
.office-ui > * { pointer-events: auto; }
.office-top { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.glass { background: rgba(14,20,40,.72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(120,140,200,.22); border-radius: 12px; }
.office-feed { position: absolute; top: 64px; right: 14px; width: 340px; max-height: calc(100% - 160px); overflow: auto; padding: 10px; }
.office-feed .ev { grid-template-columns: 50px 1fr; font-size: 12px; }
.office-chat { position: absolute; left: 50%; transform: translateX(-50%); bottom: 16px; width: min(720px, calc(100% - 28px)); display: flex; gap: 8px; padding: 8px; }
.office-chat input { background: transparent; border: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { background: transparent; color: var(--muted); border: 0; padding: 6px 10px; cursor: pointer; font: inherit; font-size: 12px; }
.seg button.active { background: var(--panel2); color: #fff; }
.office-legend { padding: 6px 10px; font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.hint { position: absolute; left: 14px; bottom: 80px; font-size: 12px; padding: 6px 10px; color: var(--muted); }
.office2d { padding: 74px 370px 90px 14px; overflow: auto; height: 100%; }
.office2d svg { width: 100%; height: auto; max-height: 56vh; display: block; }
.office2d .agent-tok { cursor: pointer; }

/* Login */
.login-body { display: grid; place-items: center; min-height: 100%; background: radial-gradient(1200px 600px at 70% -10%, #2a1d5c 0, transparent 60%), radial-gradient(900px 500px at 0% 110%, #0f3b52 0, transparent 60%), var(--bg); }
.login-card { width: min(380px, calc(100% - 32px)); background: rgba(20,27,49,.86); border: 1px solid var(--line); border-radius: 18px; padding: 26px; backdrop-filter: blur(10px); }
.login-card form { margin-top: 18px; display: flex; flex-direction: column; }
.login-card .btn { margin-top: 12px; padding: 11px; }

/* Mobil (iPhone) */
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  #nav { display: none; }
  #view { padding: calc(14px + env(safe-area-inset-top)) 14px 24px; }
  #tabbar { display: flex; justify-content: space-around; background: rgba(11,16,32,.95); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  #tabbar a { color: var(--muted); display: flex; flex-direction: column; align-items: center; font-size: 11px; gap: 2px; padding: 4px 10px; }
  #tabbar a i { font-style: normal; font-size: 18px; }
  #tabbar a.active { color: var(--accent); }
  .office-feed, .office-legend { display: none; }
  .office2d { padding: 64px 0 80px; }
  .office-chat { bottom: 10px; }
  .hint { display: none; }
  .drawer { width: 100%; }
  input, select, textarea { font-size: 16px; } /* verhindert Zoom auf iOS */
}
