/* EMQON KI-Assistent für Firmen – Designsystem der EMQON-Portale (wie AI Chatbox) */
@font-face { font-family: "Manrope"; src: url("/app/fonts/manrope.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
:root {
  --bg: #050D1A; --panel: #0B1830; --panel-2: #10223F; --line: rgba(201,210,225,.12); --line-2: rgba(201,210,225,.22);
  --ink: #FFFFFF; --soft: #A7B4C8; --mute: #7F8EA5; --blue: #0066FF; --light: #00B4FF; --silver: #C9D2E1;
  --ok: #2BD38C; --warn: #F2B705; --bad: #FF6B6B;
  --brand: linear-gradient(100deg, #0066FF, #00B4FF 55%, #C9D2E1);
  --r: 14px; --ease: cubic-bezier(.23,1,.32,1);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F3F6FB; --panel: #FFFFFF; --panel-2: #EEF3FA; --line: rgba(10,26,47,.10); --line-2: rgba(10,26,47,.18);
  --ink: #0A1A2F; --soft: #3F516C; --mute: #67788F; color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 500 15px/1.55 "Manrope", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--light); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--light); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4, p { margin: 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Layout */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.side .logo img { height: 30px; }
.side .tag { font-size: 11px; color: var(--mute); font-weight: 700; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--soft); text-decoration: none; font-weight: 600; font-size: 14.5px; transition: background-color .15s, color .15s; }
.nav a:hover { background: var(--panel-2); color: var(--ink); }
.nav a.on { background: rgba(0,102,255,.16); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(0,180,255,.3); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side .foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 13px; color: var(--mute); }
.main { padding: 28px clamp(16px, 3vw, 40px) 60px; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.top h1 { font-size: 26px; letter-spacing: -.02em; font-weight: 800; }
.top p { color: var(--soft); margin-top: 4px; }
.mobilebar { display: none; }

/* Bausteine */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.card h2 { font-size: 16px; font-weight: 800; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card .sub { color: var(--soft); font-size: 13.5px; margin-top: -6px; margin-bottom: 12px; }
.kpi .v { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; }
.kpi .l { color: var(--soft); font-size: 13px; font-weight: 600; }
.kpi .h { color: var(--mute); font-size: 12.5px; margin-top: 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 0; cursor: pointer; font-weight: 700; font-size: 14px; background: var(--blue); color: #fff; text-decoration: none; transition: transform .16s var(--ease), filter .15s; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); } .btn:active { transform: scale(.97); }
.btn.ghost { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.danger { background: #B4232B; } .btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
label.f { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--soft); }
input.i, select.i, textarea.i { width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
textarea.i { min-height: 110px; resize: vertical; }
input.i:focus, select.i:focus, textarea.i:focus { outline: none; border-color: var(--light); box-shadow: 0 0 0 3px rgba(0,180,255,.15); }
input[type=color].i { padding: 4px; height: 42px; }
.form { display: grid; gap: 14px; }
.hint { font-size: 12.5px; color: var(--mute); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); color: var(--soft); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; }
.pill.ok { background: rgba(43,211,140,.13); color: var(--ok); } .pill.warn { background: rgba(242,183,5,.13); color: var(--warn); } .pill.bad { background: rgba(255,107,107,.13); color: var(--bad); } .pill.info { background: rgba(0,180,255,.13); color: var(--light); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--mute); font-weight: 700; font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--panel-2); }
.scroll { overflow-x: auto; }
.empty { text-align: center; color: var(--mute); padding: 30px 10px; }
.bar { height: 8px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 6px; transition: width .6s var(--ease); }
.bar.warn > span { background: var(--warn); } .bar.bad > span { background: var(--bad); }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.chart > div { flex: 1; background: linear-gradient(180deg, #00B4FF, #0066FF); border-radius: 5px 5px 2px 2px; min-height: 3px; position: relative; }
.chart > div span { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--mute); }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { border: 0; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); color: var(--soft); padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.tabs button.on { background: rgba(0,102,255,.18); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(0,180,255,.4); }
.code { font-family: Consolas, "Cascadia Code", monospace; font-size: 13px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px; white-space: pre-wrap; word-break: break-all; }
.msgs { display: flex; flex-direction: column; gap: 8px; max-height: 460px; overflow-y: auto; padding: 4px; }
.msg { max-width: 80%; padding: 9px 12px; border-radius: 12px; background: var(--panel-2); font-size: 14px; white-space: pre-wrap; }
.msg.visitor { align-self: flex-end; background: rgba(0,102,255,.22); }
.msg.agent { background: rgba(43,211,140,.14); } .msg.system { align-self: center; background: none; color: var(--mute); font-size: 12.5px; }
.msg small { display: block; color: var(--mute); font-size: 11.5px; margin-bottom: 3px; }
.steps { display: grid; gap: 6px; }
.step { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--panel-2); font-size: 14px; }
.step i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 800; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-2); flex: none; }
.step.done i { background: var(--ok); color: #04241A; box-shadow: none; }
.step.next { box-shadow: inset 0 0 0 1px rgba(0,180,255,.5); }
.progress { display: flex; gap: 4px; margin: 6px 0 18px; }
.progress span { flex: 1; height: 6px; border-radius: 4px; background: var(--panel-2); }
.progress span.on { background: var(--brand); }
.wiz { max-width: 860px; }
.choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.choice label { display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice .opt { border: 1px solid var(--line-2); border-radius: 12px; padding: 14px; background: var(--panel); transition: border-color .15s, background-color .15s; height: 100%; }
.choice .opt b { display: block; } .choice .opt small { color: var(--mute); }
.choice input:checked + .opt { border-color: var(--light); background: rgba(0,102,255,.12); }
.choice input:focus-visible + .opt { outline: 2px solid var(--light); outline-offset: 2px; }
.mock { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: #fff; color: #14243B; max-width: 340px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.mock .h { padding: 12px 14px; font-weight: 700; } .mock .h small { display: block; font-weight: 500; opacity: .85; font-size: 12px; }
.mock .b { padding: 12px; background: #FAFBFD; display: grid; gap: 8px; min-height: 150px; }
.mock .m1 { background: #fff; border: 1px solid #E6EBF3; border-radius: 12px; padding: 8px 10px; font-size: 13.5px; max-width: 85%; }
.mock .m2 { border-radius: 12px; padding: 8px 10px; font-size: 13.5px; max-width: 85%; justify-self: end; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--panel-2); border: 1px solid var(--line-2); padding: 11px 16px; border-radius: 12px; font-weight: 600; opacity: 0; transition: opacity .2s, transform .25s var(--ease); z-index: 100; box-shadow: 0 16px 40px rgba(0,0,0,.35); max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { border-color: rgba(255,107,107,.5); }

/* Anmeldeseiten */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(60% 50% at 80% 10%, rgba(0,102,255,.22), transparent 70%), var(--bg); }
.auth .card { width: min(460px, 100%); padding: 30px; }
.auth.wide .card { width: min(820px, 100%); }
.auth img.logo { height: 34px; margin-bottom: 22px; }
.auth h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; }
.auth p.lead { color: var(--soft); margin-bottom: 20px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--soft); }
.check input { margin-top: 3px; }
.notice { padding: 11px 14px; border-radius: 10px; background: rgba(0,180,255,.1); border: 1px solid rgba(0,180,255,.3); font-size: 13.5px; color: var(--soft); }
.notice.warn { background: rgba(242,183,5,.1); border-color: rgba(242,183,5,.35); }

@media (max-width: 980px) {
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 25% 0 0; z-index: 50; transform: translateX(-105%); transition: transform .25s var(--ease); height: 100%; }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  .mobilebar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 40; }
  .mobilebar img { height: 26px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 60px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }


/* ---------- KI-Assistent: Chat ---------- */
.main.voll { padding: 0; display: flex; min-height: 100vh; }
.chat { display: grid; grid-template-columns: 270px minmax(0, 1fr); flex: 1; min-height: 0; height: 100vh; }
.chat .liste { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.chat .liste .kopf { padding: 16px 14px 10px; display: grid; gap: 10px; }
.chat .liste nav { overflow-y: auto; padding: 4px 8px 16px; display: grid; gap: 2px; align-content: start; }
.g { display: flex; align-items: center; gap: 6px; border-radius: 10px; }
.g button.t { flex: 1; min-width: 0; text-align: left; background: none; border: 0; cursor: pointer; padding: 9px 10px; border-radius: 10px; color: var(--soft); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g button.t:hover { background: var(--panel-2); color: var(--ink); }
.g.on button.t { background: rgba(0,102,255,.16); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(0,180,255,.3); }
.g button.x { opacity: 0; background: none; border: 0; color: var(--mute); cursor: pointer; padding: 6px 8px; border-radius: 8px; font-size: 15px; line-height: 1; }
.g:hover button.x, .g button.x:focus-visible { opacity: 1; }
.g button.x:hover { color: var(--bad); background: var(--panel-2); }
.gespraech { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.gespraech .oben { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); min-height: 58px; }
.gespraech .oben h1 { font-size: 16px; font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log { flex: 1; overflow-y: auto; padding: 22px clamp(16px, 4vw, 48px); display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.bubble { max-width: min(760px, 88%); padding: 11px 14px; border-radius: 14px; font-size: 14.8px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.nutzer { align-self: flex-end; background: rgba(0,102,255,.22); border-bottom-right-radius: 4px; }
.bubble.assistent { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble .fuss { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--mute); white-space: normal; flex-wrap: wrap; }
.bubble .fuss button { background: none; border: 0; color: var(--soft); cursor: pointer; font-weight: 700; font-size: 12px; padding: 3px 6px; border-radius: 6px; }
.bubble .fuss button:hover { background: var(--panel-2); color: var(--ink); }
.denkt { align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.denkt span { width: 7px; height: 7px; border-radius: 50%; background: var(--light); animation: puls 1.2s infinite ease-in-out; }
.denkt span:nth-child(2) { animation-delay: .15s; } .denkt span:nth-child(3) { animation-delay: .3s; }
@keyframes puls { 0%, 80%, 100% { opacity: .25; transform: scale(.85); } 40% { opacity: 1; transform: none; } }
.willkommen { margin: auto; max-width: 620px; text-align: center; display: grid; gap: 14px; padding: 20px 0; }
.willkommen h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.willkommen p { color: var(--soft); }
.schnell { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.schnell button { border: 0; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--soft); padding: 8px 13px; border-radius: 999px; font-weight: 700; font-size: 13.5px; cursor: pointer; transition: background-color .15s, color .15s; }
.schnell button:hover { background: var(--panel-2); color: var(--ink); }
.eingabe { padding: 12px clamp(16px, 4vw, 48px) 16px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.eingabe .feld { display: flex; gap: 10px; align-items: flex-end; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 8px 8px 8px 14px; transition: border-color .15s, box-shadow .15s; }
.eingabe .feld:focus-within { border-color: var(--light); box-shadow: 0 0 0 3px rgba(0,180,255,.15); }
.eingabe textarea { flex: 1; border: 0; background: none; resize: none; min-height: 24px; max-height: 220px; padding: 6px 0; font-size: 15px; line-height: 1.5; color: var(--ink); }
.eingabe textarea:focus { outline: none; }
.eingabe .hint { text-align: center; }
.einmal { font-family: Consolas, "Cascadia Code", monospace; font-size: 17px; font-weight: 700; letter-spacing: .04em; background: var(--bg); border: 1px dashed var(--light); border-radius: 10px; padding: 10px 14px; user-select: all; }
.notice.bad { background: rgba(255,107,107,.1); border-color: rgba(255,107,107,.4); }
.chat .menue { display: none; }

/* Eingebettet im Intranet (iframe): ohne Seitenleiste, kompakter */
body.eingebettet .chat { height: 100vh; grid-template-columns: 1fr; }
body.eingebettet .chat .liste { display: none; position: absolute; inset: 58px 0 0 0; z-index: 5; border-right: 0; }
body.eingebettet .chat.liste-offen .liste { display: flex; }
body.eingebettet .chat .menue { display: inline-flex; }
body.eingebettet .log { padding: 16px; }
body.eingebettet .eingabe { padding: 10px 12px 12px; }
body.eingebettet .gespraech .oben { padding: 10px 12px; }
body.eingebettet .gespraech { position: relative; }

@media (max-width: 760px) {
  .chat { grid-template-columns: 1fr; height: calc(100vh - 51px); }
  .chat .liste { display: none; }
  .chat.liste-offen .liste { display: flex; position: fixed; inset: 51px 0 0 0; z-index: 30; }
  .chat .menue { display: inline-flex; }
  .main.voll { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) { .denkt span { animation: none; opacity: .7; } .log { scroll-behavior: auto; } }
.inhalt { min-width: 0; }
body.eingebettet .chat { position: relative; }
.ico { display: inline-flex; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.sm svg { width: 16px; height: 16px; }
.eingabe .btn { width: 42px; padding: 0; }
.chat .liste nav { grid-template-columns: minmax(0, 1fr); }
.g { min-width: 0; }
.main:not(.voll) { display: grid; gap: 16px; align-content: start; }
.main:not(.voll) > .top { margin-bottom: 8px; }

/* ---------- Werkzeuge, Freigaben, Verbindungen ---------- */
.bubble ul.schritte { list-style: none; margin: 0 0 8px; padding: 0 0 8px; border-bottom: 1px solid var(--line); display: grid; gap: 2px; font-size: 12.5px; color: var(--mute); white-space: normal; }
.bubble ul.schritte li.ok { color: var(--soft); } .bubble ul.schritte li.fehler { color: var(--bad); }
.freigabe { margin-top: 10px; border: 1px solid rgba(242,183,5,.45); background: rgba(242,183,5,.07); border-radius: 12px; padding: 12px; display: grid; gap: 8px; white-space: normal; }
.freigabe.erledigt { border-color: rgba(43,211,140,.4); background: rgba(43,211,140,.06); }
.freigabe.abgelehnt, .freigabe.abgelaufen { border-color: var(--line-2); background: var(--panel-2); }
.freigabe.fehler { border-color: rgba(255,107,107,.45); background: rgba(255,107,107,.06); }
.freigabe .kopf { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.freigabe .was { white-space: pre-wrap; font-size: 13.5px; color: var(--soft); background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.card.dienst h2 .row { gap: 6px; }
.card.dienst ul.nutzen { margin: 0 0 10px; padding-left: 18px; color: var(--soft); font-size: 13.5px; display: grid; gap: 2px; }
.card.dienst .verbunden { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.card.dienst .form { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
h2.abschnitt { font-size: 18px; font-weight: 800; margin-top: 8px; }
h3.kategorie { font-size: 13px; font-weight: 800; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }
ol.anleitung { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; color: var(--soft); font-size: 14px; }
.in-teams body.eingebettet .chat { height: 100vh; }
