:root {
  --bg: #0b0b0c;
  --surface: #131316;
  --surface-2: #191920;
  --surface-3: #212129;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.12);
  --text: #ececef;
  --text-dim: #a3a3ad;
  --text-faint: #6e6e79;
  --accent: #5b9dff;
  --accent-soft: rgba(91, 157, 255, 0.14);
  --accent-line: rgba(91, 157, 255, 0.35);
  --danger: #ef7a7d;
  --ok: #62c08a;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Login ---------- */

.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: 0 1px 0 var(--line) inset, 0 24px 60px rgba(0, 0, 0, 0.5);
}

.login-card h1 {
  font-size: 20px;
}

.login-card .sub {
  margin: 6px 0 26px;
  color: var(--text-dim);
  font-size: 13.5px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  color: var(--accent);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  background: var(--surface-3);
}

textarea {
  resize: vertical;
  font-family: inherit;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #08111f;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.alert {
  margin-bottom: 16px;
  padding: 9px 12px;
  border-radius: var(--radius);
  background: rgba(239, 122, 125, 0.12);
  color: var(--danger);
  font-size: 13.5px;
}

.alert[hidden] {
  display: none;
}

.hint {
  margin-top: 20px;
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
}

/* ---------- App-Rahmen ---------- */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  height: 54px;
  flex: 0 0 auto;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
}

.brand h1 {
  font-size: 15px;
  color: var(--text);
}

.tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  padding: 3px;
  border-radius: 9px;
}

.tab {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  padding: 5px 14px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13.5px;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  background: var(--surface-3);
  color: var(--text);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.ghost-btn:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface-2);
}

main {
  flex: 1 1 auto;
  min-height: 0;
}

.view {
  display: none;
  height: 100%;
}

.view.is-active {
  display: flex;
}

/* ---------- Sidebar ---------- */

.sidebar {
  flex: 0 0 300px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
  padding: 18px 16px 28px;
}

.sidebar h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.sidebar section + section {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.model-detail {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-faint);
}

.field-note {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  color: var(--text-faint);
}

.error-text {
  color: var(--danger);
}

.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.switch-row:last-child {
  margin-bottom: 0;
}

.switch-row .switch-label {
  font-size: 13.5px;
}

.switch-row .switch-note {
  display: block;
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 2px;
}

.switch {
  position: relative;
  flex: 0 0 38px;
  height: 22px;
  margin-top: 2px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  transition: background 0.15s ease, border-color 0.15s ease;
  pointer-events: none;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: transform 0.15s ease, background 0.15s ease;
}

.switch input:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.switch input:checked + span::after {
  transform: translateX(16px);
  background: var(--accent);
}

.switch input:disabled + span {
  opacity: 0.4;
}

.switch input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.slider-row {
  margin-bottom: 16px;
}

.slider-row:last-child {
  margin-bottom: 0;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.slider-head output {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}

input[type="range"] {
  width: 100%;
  height: 18px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: var(--surface-3);
}

input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: var(--surface-3);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: -5px;
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
}

.tool-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--text-faint);
}

.tool-list li {
  padding: 3px 0 3px 12px;
  position: relative;
}

.tool-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.tool-list code {
  font-family: var(--mono);
  color: var(--text-dim);
}

/* ---------- Chat ---------- */

.chat {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px 24px 8px;
}

.messages-inner {
  max-width: 780px;
  margin: 0 auto;
}

.empty-state {
  max-width: 460px;
  margin: 9vh auto 0;
  text-align: center;
}

.empty-state .icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}

.empty-state h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.empty-state p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13.5px;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 20px;
}

.suggestion {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-dim);
  padding: 6px 13px;
  font-size: 12.5px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.suggestion:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.msg {
  margin-bottom: 22px;
}

.msg-role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 7px;
}

.msg.user .msg-role {
  color: var(--accent);
}

.msg-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.user .msg-body {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 11px 14px;
}

.msg.error .msg-body {
  color: var(--danger);
}

details.reasoning {
  margin-bottom: 12px;
  background: var(--surface);
  border-left: 2px solid var(--line-strong);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 8px 12px;
}

details.reasoning summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-faint);
  list-style: none;
}

details.reasoning summary::-webkit-details-marker {
  display: none;
}

details.reasoning summary::before {
  content: "\25B8 ";
}

details.reasoning[open] summary::before {
  content: "\25BE ";
}

details.reasoning .reasoning-body {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-dim);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tool-card {
  margin: 12px 0;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 11px 13px;
  font-size: 13px;
}

.tool-card .tool-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12.5px;
}

.tool-card .tool-badge {
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tool-card pre {
  margin: 8px 0 0;
  padding: 9px 11px;
  background: var(--surface-2);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 260px;
  overflow-y: auto;
}

.tool-card .tool-sub {
  margin-top: 9px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin-top: 12px;
}

.metric {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-dim);
}

.metric b {
  color: var(--text);
  font-weight: 500;
}

.metric.highlight {
  background: var(--accent-soft);
  color: var(--accent);
}

.metric.highlight b {
  color: var(--accent);
}

.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-faint);
  font-size: 13px;
}

.thinking-indicator .spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface-3);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .thinking-indicator .spinner {
    animation-duration: 2s;
  }
}

.composer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 14px 24px 18px;
}

.composer-inner {
  max-width: 780px;
  margin: 0 auto;
}

.composer textarea {
  min-height: 62px;
  max-height: 210px;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.composer-actions .spacer {
  flex: 1 1 auto;
}

.composer-hint {
  font-size: 11.5px;
  color: var(--text-faint);
}

.btn-send {
  background: var(--accent);
  color: #08111f;
  border: 0;
  border-radius: 8px;
  padding: 7px 18px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.btn-send:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Status ---------- */

#view-status {
  overflow-y: auto;
  padding: 28px 24px 40px;
}

.status-inner {
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

.status-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}

.status-head h2 {
  font-size: 17px;
}

.status-sub {
  color: var(--text-dim);
  font-size: 13.5px;
  margin: 0 0 22px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.status-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 18px;
}

.status-card .card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 3px;
}

.status-card h3 {
  font-size: 14.5px;
}

.status-card .card-detail {
  color: var(--text-faint);
  font-size: 12px;
  margin: 0 0 16px;
}

.pill {
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--surface-3);
  color: var(--text-dim);
}

.pill.ok {
  background: rgba(98, 192, 138, 0.14);
  color: var(--ok);
}

.pill.bad {
  background: rgba(239, 122, 125, 0.14);
  color: var(--danger);
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 14px;
  font-size: 13px;
}

.kv dt {
  color: var(--text-faint);
}

.kv dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  text-align: right;
  overflow-wrap: anywhere;
}

.only-mobile {
  display: none;
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    z-index: 20;
    top: 54px;
    left: 0;
    bottom: 0;
    width: min(88vw, 320px);
    flex: none;
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.55);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .only-mobile {
    display: inline-block;
  }

  .messages,
  .composer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar {
    gap: 10px;
  }

  .brand h1 {
    display: none;
  }
}

/* ---------- Scrollbalken ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
  background-clip: content-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

/* ---------- Aufklappbare Erklaerungen ---------- */
.hint {
  margin-top: 9px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.hint > summary {
  cursor: pointer;
  color: var(--text-faint);
  font-size: 12.5px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.12s ease;
}

.hint > summary::-webkit-details-marker {
  display: none;
}

.hint > summary::before {
  content: "?";
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 700;
  flex: none;
}

.hint > summary:hover {
  color: var(--text-dim);
}

.hint[open] > summary {
  color: var(--text-dim);
  margin-bottom: 6px;
}

.hint p {
  margin: 0 0 7px;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.6;
}

.hint p:last-child {
  margin-bottom: 0;
}

.hint strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Suchanbieter ---------- */
.keys-grid {
  display: grid;
  gap: 12px;
}

.key-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
}

.key-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 5px;
}

.key-head h3 {
  font-size: 14.5px;
}

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-dim);
  font-weight: 500;
}

.badge-ok {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}

.key-hint {
  margin: 0 0 11px;
  color: var(--text-faint);
  font-size: 12.5px;
}

.key-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.key-input {
  flex: 1 1 220px;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 11px;
  font-family: var(--mono);
  font-size: 12.5px;
}

.key-input:focus {
  border-color: var(--accent-line);
  outline: none;
}

.key-btn {
  flex: none;
  padding: 8px 13px;
  font-size: 13px;
}

.key-danger:hover {
  color: var(--danger);
  border-color: rgba(239, 122, 125, 0.4);
}

.key-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 12.5px;
  text-decoration: none;
}

.key-link:hover {
  text-decoration: underline;
}

.key-msg {
  margin: 9px 0 0;
  font-size: 12.5px;
  color: var(--text-faint);
  min-height: 1px;
}

.key-msg:empty {
  margin: 0;
}

.key-msg.is-ok {
  color: var(--ok);
}

.key-msg.is-err {
  color: var(--danger);
}

/* ---------- Hilfekarten ---------- */
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 12px;
}

.help-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 15px;
}

.help-card h3 {
  font-size: 13.5px;
  font-family: var(--mono);
  color: var(--accent);
  margin-bottom: 6px;
}

.help-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ---------- API und Wissensdatenbank ---------- */
.key-select {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 11px;
  font-size: 13px;
  flex: 0 1 210px;
}

.key-narrow {
  flex: 0 0 92px;
}

.badge-off {
  background: rgba(239, 122, 125, 0.14);
  color: var(--danger);
}

.secret-box {
  margin-top: 12px;
  padding: 12px 13px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  border-radius: 8px;
}

.secret-label {
  margin: 0 0 7px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.secret-box code {
  display: block;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  user-select: all;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
  align-items: center;
}

.chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.chip:hover {
  background: var(--surface-3);
}

.chip.is-active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.chip-count {
  font-size: 11px;
  color: var(--text-faint);
}

.chip-remove {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 6px;
}

.chip-remove:hover {
  color: var(--danger);
  background: rgba(239, 122, 125, 0.1);
}

.doc-list {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 9px 12px;
}

.doc-title {
  flex: 1;
  font-size: 13.5px;
}

.doc-meta {
  font-size: 12px;
  color: var(--text-faint);
}

.hit-card {
  background: var(--surface-2);
  border-left: 2px solid var(--accent-line);
  border-radius: 6px;
  padding: 10px 13px;
}

.hit-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 5px;
}

.hit-score {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
}

.hit-text {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: pre-wrap;
  line-height: 1.55;
}

/* ---------- Statistik ---------- */
.range-row {
  display: flex;
  gap: 5px;
}

.range-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 7px;
  padding: 6px 11px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.range-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.range-btn.is-active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 11px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-faint);
}

.stat-value {
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--text-faint);
}

.chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 132px;
  padding-top: 8px;
}

.bar-col {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
}

.bar {
  width: 100%;
  max-width: 26px;
  background: var(--accent-soft);
  border-top: 2px solid var(--accent);
  border-radius: 3px 3px 0 0;
  transition: background 0.12s ease;
}

.bar-col:hover .bar {
  background: var(--accent-line);
}

.bar-label {
  font-size: 9.5px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.stat-tables {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.mini-table {
  display: grid;
  gap: 4px;
}

.mini-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: var(--surface-2);
  border-radius: 7px;
  font-size: 12.5px;
}

.mini-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-val {
  color: var(--text-faint);
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- Statistik: Filter, Diagramme, Protokoll ---------- */
.stat-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.filter-label {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
}

.stat-card.is-warn .stat-value {
  color: var(--danger);
}

.stat-card.is-ok .stat-value {
  color: var(--ok);
}

.chart-svg {
  width: 100%;
  height: 170px;
  display: block;
}

.grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.axis-text {
  fill: var(--text-faint);
  font-size: 9.5px;
}

.bar-prompt {
  fill: rgba(91, 157, 255, 0.32);
}

.bar-out {
  fill: var(--accent);
}

.legend {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-faint);
  margin-left: auto;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
  margin-left: 8px;
  margin-right: 2px;
}

.dot-prompt {
  background: rgba(91, 157, 255, 0.32);
}

.dot-out {
  background: var(--accent);
}

.hbar-row {
  margin-bottom: 9px;
}

.hbar-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  margin-bottom: 4px;
}

.hbar-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hbar-val {
  color: var(--text-faint);
  font-size: 11.5px;
  white-space: nowrap;
}

.hbar-track {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}

.hbar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

.log-table {
  display: grid;
  gap: 2px;
  overflow-x: auto;
}

.log-row {
  display: grid;
  grid-template-columns: 96px 84px 54px minmax(110px, 1fr) 62px 62px 62px 74px auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--surface-2);
  min-width: 720px;
}

.log-row.is-head {
  background: transparent;
  color: var(--text-faint);
  font-size: 11px;
  padding-bottom: 2px;
}

.log-time {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.log-key {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
}

.log-flags {
  display: flex;
  gap: 4px;
}

.flag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.flag-rag {
  background: var(--accent-soft);
  color: var(--accent);
}

.flag-tool {
  background: rgba(98, 192, 138, 0.14);
  color: var(--ok);
}

.flag-err {
  background: rgba(239, 122, 125, 0.14);
  color: var(--danger);
}
