:root {
  --bg: #121816;
  --bg-deep: #0b100e;
  --panel: #1a221f;
  --panel-2: #222c28;
  --ink: #e8efe9;
  --muted: #9aada3;
  --line: #2c3933;
  --accent: #d4a574;
  --accent-2: #e0b98a;
  --accent-ink: #1a120a;
  --good: #6fbf8a;
  --warn: #e0b35a;
  --bad: #e07a6a;
  --user: #24352e;
  --bot: #1c2622;
  --radius: 22px;
  --radius-sm: 14px;
  --radius-pill: 999px;
  --font-display: "Bricolage Grotesque", Georgia, serif;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
html, body { margin: 0; height: 100%; }
body {
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(90% 60% at 10% -10%, rgba(212, 165, 116, 0.14), transparent 50%),
    radial-gradient(70% 50% at 100% 0%, rgba(111, 191, 138, 0.08), transparent 45%),
    linear-gradient(180deg, #15201c 0%, var(--bg) 40%, var(--bg-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

button, input, textarea, select { font: inherit; }
button {
  cursor: pointer;
  border: none;
  border-radius: 12px;
  padding: 0.65rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  transition: 0.15s background, 0.15s transform;
}
button:hover { background: var(--accent-2); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.ghost:hover { background: var(--panel-2); }
button.sec { background: var(--panel-2); color: var(--ink); }
button.sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; font-weight: 600; }
button.danger { background: var(--bad); color: #1a0b09; }

input, textarea, select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(212, 165, 116, 0.35);
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 4.5rem; }
label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.3rem;
}
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---- Login (eine Komposition) ---- */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.login::before {
  content: "";
  position: absolute;
  inset: -20% 20% auto -10%;
  height: 55%;
  background: radial-gradient(circle at 30% 40%, rgba(212, 165, 116, 0.22), transparent 60%);
  animation: drift 14s ease-in-out infinite alternate;
  pointer-events: none;
}
.login::after {
  content: "";
  position: absolute;
  inset: auto -15% -25% 35%;
  height: 50%;
  background: radial-gradient(circle at 60% 40%, rgba(111, 191, 138, 0.12), transparent 55%);
  animation: drift 18s ease-in-out infinite alternate-reverse;
  pointer-events: none;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4%, 3%, 0) scale(1.05); }
}
.login-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  text-align: center;
}
.login-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.8rem, 10vw, 3.6rem);
  letter-spacing: -0.04em;
  margin: 0 0 0.4rem;
  background: linear-gradient(105deg, #f0d2ae, #d4a574 45%, #9fd0b0);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: brandIn 0.7s ease-out both;
}
@keyframes brandIn {
  from { opacity: 0; transform: translateY(12px); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}
.login-tag {
  color: var(--muted);
  margin: 0 0 1.8rem;
  font-size: 1.05rem;
  animation: brandIn 0.7s 0.1s ease-out both;
}
.login-form {
  display: grid;
  gap: 0.8rem;
  text-align: left;
  animation: brandIn 0.7s 0.18s ease-out both;
}
.login-form button { width: 100%; padding: 0.85rem; font-size: 1rem; }
.login-hint { margin-top: 1rem; font-size: 0.85rem; color: var(--muted); }

/* ---- App shell ---- */
.shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 24, 22, 0.88);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand-mini {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  color: var(--accent);
}
.nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.nav button.active {
  background: var(--accent);
  color: var(--accent-ink);
}
.nav button:not(.active) {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
}
.nav button:not(.active):hover {
  border-color: var(--line);
  color: var(--ink);
}
.top-actions { display: flex; gap: 0.4rem; align-items: center; }
.pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
}
.pill.warn { color: var(--warn); background: rgba(224, 179, 90, 0.12); }
.pill.good { color: var(--good); background: rgba(111, 191, 138, 0.12); }

.main {
  min-height: 0;
  display: grid;
}

/* ---- Chat ---- */
.chat-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px 1fr;
}
@media (max-width: 820px) {
  .chat-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: absolute; inset: 0; z-index: 30; }
}
.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(11, 16, 14, 0.55);
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 0;
}
.sidebar h3 {
  margin: 0.2rem 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.conv-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}
.conv-item {
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
  padding: 0.65rem 0.7rem;
  font-weight: 500;
}
.conv-item:hover, .conv-item.active {
  background: var(--panel);
  border-color: var(--line);
}
.conv-item .preview {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-pane {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
}
.messages {
  overflow: auto;
  padding: 1.1rem 1.1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.msg {
  max-width: min(720px, 92%);
  padding: 0.85rem 1rem;
  border-radius: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  animation: msgIn 0.28s ease-out both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.msg.user {
  align-self: flex-end;
  background: var(--user);
  border: 1px solid #314840;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--bot);
  border: 1px solid var(--line);
}
.msg .meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}
.composer {
  padding: 0.8rem 1rem 1.1rem;
  border-top: 1px solid var(--line);
  background: rgba(18, 24, 22, 0.92);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: end;
}
.composer textarea {
  min-height: 3.2rem;
  max-height: 10rem;
  border-radius: 14px;
}
.empty-chat {
  margin: auto;
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  max-width: 28rem;
}
.empty-chat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

/* ---- Memory / Reminders / Settings ---- */
.page {
  overflow: auto;
  padding: 1.1rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.page-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}
.toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.fact-grid, .rem-grid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.fact, .rem {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.fact-top, .rem-top {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: start;
}
.fact .cat {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}
.fact .body {
  margin-top: 0.35rem;
  font-size: 1.02rem;
}
.fact .body b { font-weight: 700; }
.fact .src {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.rem.due-soon { border-color: rgba(224, 179, 90, 0.45); }
.rem.overdue { border-color: rgba(224, 122, 106, 0.55); }

.form-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  display: grid;
  gap: 0.7rem;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .top { padding: 0.55rem 0.6rem; }
  .brand-mini { font-size: 1.1rem; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.7rem 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 100;
  max-width: min(90vw, 420px);
}
.toast[hidden] { display: none; }

.typing {
  align-self: flex-start;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.4rem 0.2rem;
}
.typing span {
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  margin: 0 0.1rem;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

/* ---- Zuhören / Personen (runder, weicher) ---- */
.who-banner {
  margin: 0.85rem 1.1rem 0;
  padding: 1rem 1.15rem;
  border-radius: 24px;
  border: 1px solid rgba(212, 165, 116, 0.35);
  background:
    linear-gradient(135deg, rgba(212, 165, 116, 0.16), rgba(212, 165, 116, 0.05));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  animation: msgIn 0.4s ease-out both;
}
.who-banner strong {
  color: var(--accent-2);
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.chip {
  border: 1px solid var(--line);
  background: rgba(26, 34, 31, 0.9);
  color: var(--ink);
  border-radius: var(--radius-pill);
  padding: 0.38rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 650;
  transition: 0.18s border-color, 0.18s background, 0.18s transform;
}
.chip:hover, .chip.active {
  border-color: var(--accent);
  background: rgba(212, 165, 116, 0.18);
  color: var(--accent-2);
  transform: translateY(-1px);
}
.block {
  background:
    linear-gradient(180deg, rgba(34, 44, 40, 0.95), rgba(26, 34, 31, 0.92));
  border: 1px solid rgba(44, 57, 51, 0.9);
  border-radius: 26px;
  padding: 1rem 1.15rem 1.1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  transition: 0.2s border-color, 0.2s transform, 0.2s box-shadow;
  animation: msgIn 0.35s ease-out both;
}
.block:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
}
.block.unassigned {
  border-color: rgba(224, 179, 90, 0.5);
  box-shadow:
    inset 4px 0 0 var(--warn),
    0 10px 30px rgba(0, 0, 0, 0.22);
}
.block.assigned {
  border-color: rgba(111, 191, 138, 0.28);
}
.block-top {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}
.block-top select {
  width: auto;
  min-width: 10rem;
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.85rem;
  background: var(--bg-deep);
  border-color: rgba(212, 165, 116, 0.25);
}
.block-text {
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
}
#block-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.person-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 1rem 1.15rem;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.person-card .name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}
.listen-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
}
.listen-layout .sidebar {
  padding: 1rem 0.95rem;
  gap: 0.55rem;
  background:
    linear-gradient(180deg, rgba(26, 34, 31, 0.88), rgba(18, 24, 22, 0.92));
  border-right: 1px solid rgba(44, 57, 51, 0.85);
}
.listen-layout .sidebar h3 {
  margin: 1rem 0 0.4rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.listen-layout .sidebar > button {
  border-radius: var(--radius-pill);
  width: 100%;
}
@media (max-width: 820px) {
  .listen-layout { grid-template-columns: 1fr; }
  .listen-layout .sidebar { display: none; }
}
.mic-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--bad);
  display: inline-block;
  animation: blink 1s infinite;
  box-shadow: 0 0 0 4px rgba(224, 122, 106, 0.18);
}
.rec-bar, .listen-control {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(44, 57, 51, 0.8);
  background:
    linear-gradient(180deg, rgba(18, 24, 22, 0.92), rgba(11, 16, 14, 0.72));
  backdrop-filter: blur(8px);
}
.listen-go, .listen-stop {
  min-width: 6.6rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-pill);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}
.listen-go {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #1a1208;
  border: 1px solid transparent;
}
.listen-go:hover { filter: brightness(1.05); }
.listen-go:disabled { opacity: 0.4; filter: none; box-shadow: none; }
.listen-stop {
  background: linear-gradient(180deg, #d96a5c, #b83c32);
  color: #fff;
  border: 1px solid transparent;
}
.listen-stop:disabled { opacity: 0.35; box-shadow: none; }
.listen-state {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  margin-right: 0.35rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(44, 57, 51, 0.8);
}
.mode-toggle {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.45rem 0.7rem;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--line);
}
.mode-toggle input { width: auto; accent-color: var(--accent); }
.roster { display: flex; flex-direction: column; gap: 0.4rem; }
.roster-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  font-size: 0.82rem;
  background: rgba(0, 0, 0, 0.12);
}
.roster-row.unassigned-row {
  border-color: rgba(224, 179, 90, 0.45);
}
.speaker-tag {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-pill);
  background: rgba(212, 165, 116, 0.16);
  color: var(--accent-2);
  border: 1px solid rgba(212, 165, 116, 0.22);
}
.speaker-tag.unknown {
  background: rgba(224, 179, 90, 0.12);
  color: var(--warn);
  border-color: rgba(224, 179, 90, 0.3);
}
.block.speaker-switch { margin-top: 0.35rem; }
.listen-layout .composer {
  border-radius: 0;
  padding: 0.85rem 1.1rem 1.1rem;
  gap: 0.65rem;
}
.listen-layout .composer textarea {
  border-radius: 22px;
  min-height: 3.2rem;
  padding: 0.85rem 1rem;
}
.listen-layout .composer button {
  border-radius: var(--radius-pill);
  align-self: stretch;
  min-width: 5.5rem;
}
.pill {
  border-radius: var(--radius-pill);
  padding: 0.28rem 0.75rem;
}
.mic-pick {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-weight: 600;
}
.mic-pick select {
  width: auto;
  min-width: 11rem;
  max-width: 16rem;
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.8rem;
  font-size: 0.82rem;
}
.listen-reply-btn {
  border-radius: var(--radius-pill) !important;
  background: linear-gradient(180deg, #7ecb96, #5aa873) !important;
  color: #0d1a12 !important;
  font-weight: 800 !important;
  padding: 0.55rem 1.05rem !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}
.listen-reply-btn:disabled {
  opacity: 0.45;
  box-shadow: none;
}
.fidolin-reply {
  margin: 0.85rem 1.1rem 0;
  padding: 1rem 1.15rem;
  border-radius: 24px;
  border: 1px solid rgba(111, 191, 138, 0.35);
  background:
    linear-gradient(135deg, rgba(111, 191, 138, 0.14), rgba(26, 34, 31, 0.5));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
  animation: msgIn 0.4s ease-out both;
}
.fidolin-reply-top {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}
.fidolin-reply-top strong {
  font-family: var(--font-display);
  color: var(--good);
  margin-right: 0.3rem;
}
.fidolin-reply-body {
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 1.05rem;
}
.mix-row { margin: 0.55rem 0; }
.mix-row label { display: block; margin-bottom: 0.2rem; font-size: 0.85rem; }
.voice-catalog {
  max-height: 16rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  background: rgba(0,0,0,0.15);
}
.voice-group { margin-bottom: 0.7rem; }
.voice-group b { display: block; margin: 0.3rem 0; font-size: 0.8rem; color: var(--accent-2); }
.voice-row {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: start;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.voice-name { font-weight: 650; font-size: 0.86rem; }
.chat-quips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0.45rem 1rem 0;
  border-top: 1px solid var(--line);
}
