/* Atlas Dashboard — Chat-UI im warmen Palette-Sprech-Look des Scan-Knights,
   aber mit ruhigerem Command-Zentrum-Charakter (etwas dunkler, mehr Kontrast). */

:root {
  --bg: #17140f;
  --bg-panel: #1e1a15;
  --bg-bubble-bot: #26221c;
  --bg-bubble-user: #c25a3a;
  --bg-bubble-draft: #3f3a30;
  --text: #f6ece1;
  --text-muted: #a89f92;
  --accent: #c25a3a;
  --accent-hover: #d16a48;
  --line: #2f2b25;
  --danger: #e05a3a;
  --success: #6fbf8a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 600;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
body { overflow: hidden; }

#chat {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: 0.02em; }
.brand-sub { color: var(--text-muted); font-size: 13px; font-weight: 600; margin-left: auto; }
.brand-sub.working { color: var(--accent); }
.brand-sub.error { color: var(--danger); }

.tabs {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}
.tab {
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}

.view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.view[hidden] { display: none; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.msg {
  display: flex;
  max-width: 92%;
}
.msg-user { align-self: flex-end; }
.msg-bot  { align-self: flex-start; }

.bubble {
  padding: 12px 15px;
  border-radius: 16px;
  line-height: 1.4;
  font-size: 15.5px;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg-user .bubble {
  background: var(--bg-bubble-user);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.msg-bot .bubble {
  background: var(--bg-bubble-bot);
  border-bottom-left-radius: 5px;
}
.msg-bot.draft .bubble {
  background: var(--bg-bubble-draft);
  border: 1px solid rgba(194, 90, 58, 0.35);
}
.msg-bot.confirmed .bubble {
  background: rgba(111, 191, 138, 0.14);
  border: 1px solid rgba(111, 191, 138, 0.35);
}
.msg-bot.error .bubble {
  background: rgba(224, 90, 58, 0.14);
  border: 1px solid rgba(224, 90, 58, 0.35);
}
.msg-bot.answer .bubble {
  background: rgba(120, 155, 235, 0.14);
  border: 1px solid rgba(120, 155, 235, 0.35);
}
.msg-bot.clarify .bubble {
  background: rgba(230, 190, 90, 0.10);
  border: 1px solid rgba(230, 190, 90, 0.35);
}
.clarify-buttons {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.clarify-btn {
  font: inherit;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(230, 190, 90, 0.55);
  background: rgba(230, 190, 90, 0.10);
  color: var(--text);
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}
.clarify-btn:hover:not(:disabled) {
  background: rgba(230, 190, 90, 0.20);
}
.clarify-btn.selected {
  background: rgba(230, 190, 90, 0.35);
  border-color: rgba(230, 190, 90, 0.75);
}
.clarify-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.hint {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.badge {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.12);
  color: var(--text);
}
.badge.provision { background: rgba(194, 90, 58, 0.25); color: #f3b48f; }
.badge.reminder  { background: rgba(111, 191, 138, 0.22); color: #a5dfb5; }
.badge.answer    { background: rgba(120, 155, 235, 0.22); color: #b7c9f2; }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg-panel);
  border-top: 1px solid var(--line);
}
#input {
  flex: 1;
  min-height: 44px;
  max-height: 30vh;
  padding: 12px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: #24201a;
  border: 1px solid var(--line);
  border-radius: 22px;
  resize: none;
  outline: none;
}
#input:focus { border-color: var(--accent); }
#send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 120ms ease;
  flex: 0 0 44px;
}
#send:hover { background: var(--accent-hover); }
#send:disabled { opacity: 0.5; cursor: default; }

/* Typing indicator */
.typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg-bubble-bot);
  border-radius: 16px;
  border-bottom-left-radius: 5px;
}
.typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: dot 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ── Stats View ─────────────────────────────────────────────────────── */

#view-stats { overflow-y: auto; }
.stats-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 22px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  width: 100%;
}
.stats-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stats-heading {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--bg-bubble-bot);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 108px;
  justify-content: space-between;
}
.stat-card--total {
  background: rgba(194, 90, 58, 0.10);
  border-color: rgba(194, 90, 58, 0.35);
}
.stat-card--muted {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.06);
}
.stat-card--critical {
  background: rgba(224, 90, 58, 0.12);
  border-color: rgba(224, 90, 58, 0.45);
}
.stat-card--critical .stat-value { color: #f3b48f; }
.stat-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.stat-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}
.stat-sub {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.stats-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.btn-refresh {
  font: inherit;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 120ms ease;
}
.btn-refresh:hover { background: rgba(194, 90, 58, 0.15); }
.stats-updated {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}
