/* Quinn – dunkle Leitstelle: tiefes Nachtblau, Eisblau fuer Quinn, Kobalt fuer Aktionen, Bernstein fuer Hinweise */
:root {
  color-scheme: dark;
  --bg: #05070D;
  --panel: #0D1527;
  --panel-2: #121C33;
  --line: #1D2944;
  --line-2: #2B3B60;
  --fg: #EAF0FA;
  --muted: #8F9CB8;
  --dim: #5D6986;
  --ice: #9BD4FF;
  --cobalt: #4F6DFF;
  --amber: #FFB547;
  --ok: #46D79C;
  --bad: #FF7A7A;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--font);
  background-image: radial-gradient(50rem 30rem at 50% -10%, rgba(79, 109, 255, .22), transparent 70%); }
button { font: inherit; color: inherit; cursor: pointer; }
.screen { min-height: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.error { color: var(--bad); min-height: 1.5em; }

/* Kreis-Symbol (Quinn) */
.orb { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ice); position: relative;
  box-shadow: 0 0 16px rgba(155, 212, 255, .55), inset 0 0 10px rgba(79, 109, 255, .5); flex: none; }
.orb i { position: absolute; inset: 22%; border-radius: 50%; background: radial-gradient(circle, var(--ice), var(--cobalt) 70%);
  animation: pulse 2.6s ease-in-out infinite; }
.orb.big { width: 96px; height: 96px; border-width: 3px; margin: 0 auto 1.2rem; }
.orb.thinking i { animation-duration: .8s; }
@keyframes pulse { 50% { transform: scale(.72); opacity: .7; } }

/* Anmeldung */
#login { display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left, 0px)); }
.login-box { width: min(360px, 100%); text-align: center; display: grid; gap: .8rem; }
.login-box h1 { margin: 0; font-size: 2.2rem; letter-spacing: .02em; }
.primary { background: var(--fg); color: var(--bg); border: 0; border-radius: 999px; padding: .85rem 1.3rem; font-weight: 650; }
.ghost { background: transparent; border: 1px solid var(--line-2); border-radius: 999px; padding: .75rem 1.2rem; }

/* App-Rahmen */
#app { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; height: 100dvh; }
.top { display: flex; align-items: center; justify-content: space-between; position: relative;
  padding: calc(10px + var(--safe-t)) 16px 10px; border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 13, .8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: .04em; }
.top-actions { display: flex; gap: .3rem; }
.icon { background: transparent; border: 1px solid transparent; border-radius: 12px; width: 40px; height: 40px; font-size: 1.1rem; }
.icon[aria-pressed="true"] { border-color: var(--ice); color: var(--ice); }
.menu { position: absolute; right: 12px; top: calc(100% + 6px); background: var(--panel-2); border: 1px solid var(--line-2);
  border-radius: 14px; padding: 6px; display: grid; z-index: 20; min-width: 220px; box-shadow: 0 20px 40px rgba(0, 0, 0, .5); }
.menu button { background: none; border: 0; text-align: left; padding: .7rem .9rem; border-radius: 10px; }
.menu button:hover { background: var(--panel); }
main { overflow: hidden; position: relative; }
.view { height: 100%; display: flex; flex-direction: column; }

/* Chat */
.chat { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }
.welcome { margin: auto 0; text-align: center; display: grid; gap: .4rem; padding: 1rem 0; }
.hello { font-size: 1.5rem; font-weight: 700; margin: 0; }
.welcome p { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: 1rem; }
.chip { background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; padding: .5rem .9rem; font-size: .9rem; }
.msg { max-width: 88%; padding: .7rem .95rem; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; }
.msg.du { align-self: flex-end; background: var(--cobalt); color: #fff; border-bottom-right-radius: 6px; }
.msg.quinn { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.denkt { color: var(--muted); display: flex; align-items: center; gap: .6rem; }
.composer { display: flex; align-items: flex-end; gap: .5rem; padding: 10px 12px calc(10px + var(--safe-b));
  border-top: 1px solid var(--line); background: rgba(5, 7, 13, .9); }
.composer textarea { flex: 1; resize: none; max-height: 140px; background: var(--panel); border: 1px solid var(--line-2);
  color: var(--fg); border-radius: 20px; padding: .65rem .95rem; font: inherit; }
.composer textarea:focus { outline: none; border-color: var(--ice); }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--fg); color: var(--bg); font-size: 1.1rem; flex: none; }
.mic { flex: none; }
.mic.on { color: var(--bad); border-color: var(--bad); animation: pulse 1s infinite; }

/* Quellen unter einer Antwort */
.sources { align-self: flex-start; max-width: 88%; display: flex; flex-wrap: wrap; gap: .35rem; margin-top: -4px; }
.sources a { font-size: .78rem; color: var(--ice); text-decoration: none; border: 1px solid var(--line-2);
  border-radius: 999px; padding: .2rem .65rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Hinweis oben im Chat (Budget, fehlender Schluessel) */
.notice { margin: 10px 16px 0; padding: .6rem .9rem; border-radius: 14px; border: 1px solid var(--amber);
  background: rgba(255, 181, 71, .08); color: var(--amber); font-size: .88rem; text-align: left; }

/* Uebersicht */
.uebersicht { flex: 1; overflow-y: auto; padding: 16px 16px calc(16px + var(--safe-b)); display: grid; gap: 14px; align-content: start; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 1rem; display: grid; gap: .6rem; }
.box h2 { margin: 0; font-size: .78rem; font-family: var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ice); display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; }
.box p { margin: 0; }
.box ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .55rem; }
.box li { line-height: 1.4; }
.mem li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; border-top: 1px solid var(--line); padding-top: .55rem; }
.mem li:first-child { border-top: 0; padding-top: 0; }
.mem button { flex: none; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: .35rem .6rem; font-size: .8rem; color: var(--muted); }
.form { display: flex; gap: .5rem; }
.form input { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--fg);
  border-radius: 12px; padding: .6rem .75rem; font: inherit; }
.form input:focus { outline: none; border-color: var(--ice); }
.form button { flex: none; background: var(--fg); color: var(--bg); border: 0; border-radius: 12px; padding: .6rem .9rem; font-weight: 650; }
.form button:disabled { opacity: .5; }
.form + .error { margin: .35rem 0 0; min-height: 0; }
.link { background: none; border: 0; padding: 0; color: var(--ice); font-size: .85rem; justify-self: start; }
.okc { color: var(--ok); }
.meter { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ice); border-radius: inherit; }
.meter.high i { background: var(--amber); }
.warn { color: var(--amber); }
.small { font-size: .85rem; }
.refresh { background: none; border: 0; color: var(--muted); font: .8rem var(--font); letter-spacing: 0; text-transform: none; white-space: nowrap; }

/* Tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); background: rgba(5, 7, 13, .95);
  padding-bottom: var(--safe-b); }
.tab { background: none; border: 0; padding: .55rem 0 .6rem; color: var(--dim); display: grid; justify-items: center; gap: .1rem; font-size: .75rem; position: relative; }
.tab span { font-size: 1.15rem; }
.tab.active { color: var(--ice); }
/* Bei geoeffneter Tastatur auf dem Handy die Tabs ausblenden */
body.typing .tabs { display: none; }

/* Rueckfrage */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: end center; z-index: 50; padding: 16px; }
.modal-box { width: min(480px, 100%); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 20px; padding: 1.1rem;
  display: grid; gap: .9rem; margin-bottom: var(--safe-b); }
.modal-box p { margin: 0; }
.modal-box textarea { background: var(--panel); border: 1px solid var(--line-2); color: var(--fg); border-radius: 12px; padding: .6rem; font: inherit; }
.modal-box .row { display: flex; gap: .6rem; }
.modal-box .row button { flex: 1; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } }
