/* JARVIS-3 devnotes — nur was das Design-System über diese Anwendung nicht
   wissen kann. Komponenten (.btn, .panel, .badge …) werden nicht überschrieben;
   alles Eigene trägt einen eigenen Namen. */

/* ── Marke ─────────────────────────────────────────────────────────── */
.brand__sub {
  margin-left: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: var(--fw-normal);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.app-body { padding-block: var(--sp-7) var(--sp-10); }

.topbar-title {
  max-width: 56vw;
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  letter-spacing: -.01em;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Seitenkopf ─────────────────────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-5);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}

.page-head--tight { margin-bottom: var(--sp-5); }

.kicker {
  margin: 0 0 var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--faint);
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: var(--fw-semibold);
  letter-spacing: -.02em;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.lead {
  max-width: 62ch;
  margin: var(--sp-3) 0 0;
  font-size: var(--fs-md);
  color: var(--muted);
}

.breadcrumb {
  margin: 0 0 var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
}

.breadcrumb a { color: var(--dim); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

.project-ref {
  margin: var(--sp-2) 0 0;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ── Projekt-Schiene (Chat-Liste) ───────────────────────────────────── */
.rail {
  position: sticky;
  top: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.rail-search { font-size: var(--fs-sm); }

.rail-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  padding-right: 2px;
}

.rail-empty {
  margin: var(--sp-3) 0;
  font-size: var(--fs-sm);
  color: var(--faint);
  text-align: center;
}

.rail-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 8px var(--sp-3);
  color: var(--dim);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}

.rail-item:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 5%, transparent); }

.rail-item.is-active {
  color: var(--fg);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.rail-item__dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .5;
}

.rail-item__dot.is-pending { background: var(--ember); opacity: 1; box-shadow: 0 0 8px var(--ember-soft); }
.rail-item.is-active .rail-item__dot { opacity: 1; }

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

.rail-item__name {
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-item__sub {
  font-size: var(--fs-xs);
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-item__count {
  flex: 0 0 auto;
  padding: 1px 7px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--dim);
  background: color-mix(in srgb, var(--fg) 8%, transparent);
  border-radius: var(--r-pill);
}

/* ── Übersicht: lange Liste der Projekte ────────────────────────────── */
.overview { display: flex; flex-direction: column; gap: var(--sp-4); }

.ov-item {
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast) var(--ease);
}

.ov-item:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

.ov-item__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.ov-item__name {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  line-height: 1.25;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}

.ov-item__name:hover { color: var(--accent); }

.ov-item__stats {
  margin-left: auto;
  font-size: var(--fs-sm);
  color: var(--dim);
  white-space: nowrap;
}

.ov-item__stats b { color: var(--fg); font-weight: var(--fw-semibold); }

.ov-item__ref {
  margin: var(--sp-2) 0 0;
  font-size: var(--fs-sm);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ov-item__notes {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line-soft);
}

.ov-note {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 5px var(--sp-2);
  color: var(--fg-soft);
  text-decoration: none;
  border-radius: var(--r-sm);
}

.ov-note:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); color: var(--fg); }

.ov-note__dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .55;
}

.ov-note__dot.is-pending { background: var(--ember); opacity: 1; box-shadow: 0 0 8px var(--ember-soft); }

.ov-note__body {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--fs-md);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ov-note__ki,
.ov-note__more {
  flex: 0 0 auto;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: var(--r-pill);
}

.ov-note__more { color: var(--dim); background: color-mix(in srgb, var(--fg) 8%, transparent); }

.ov-note__time {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--faint);
  white-space: nowrap;
}

.ov-item__empty { margin: var(--sp-3) 0 0; font-size: var(--fs-sm); color: var(--faint); }

.ov-item__open {
  display: inline-block;
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--accent);
  text-decoration: none;
}

.ov-item__open:hover { text-decoration: underline; }

/* ── Kontextspalte ──────────────────────────────────────────────────── */
.ctx { position: sticky; top: var(--sp-5); }

.ctx-panel .panel__head { margin-bottom: var(--sp-3); }

.ctx-stats {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--dim);
}

.ctx-stats b { color: var(--fg); font-weight: var(--fw-semibold); }
.ctx-stats .is-pending, .ctx-stats .is-pending b { color: var(--ember); }

.ctx-ref {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* ── Karten/Formulare ───────────────────────────────────────────────── */
.form-panel {
  margin-bottom: var(--sp-5);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.form-panel__title {
  margin: 0 0 var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
}

.form-panel .grid { margin-bottom: var(--sp-4); }

.empty {
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
}

/* ── Composer ───────────────────────────────────────────────────────── */
.composer {
  margin-bottom: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.composer__label {
  display: block;
  margin-bottom: var(--sp-3);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
}

.composer__input {
  width: 100%;
  min-height: 78px;
  padding: var(--sp-3) var(--sp-4);
  font: inherit;
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--fg);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  resize: vertical;
}

.composer__input::placeholder { color: var(--faint); }

.composer__input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.composer__bar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-top: var(--sp-4);
}

.composer__right { display: flex; align-items: center; gap: var(--sp-3); margin-left: auto; }

.counter { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--muted); }
.counter.is-over { color: var(--off); font-weight: var(--fw-semibold); }

.attachment:not(:empty) { margin-top: var(--sp-4); }
.attachment .field { margin: 0; }

/* Segmente */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}

.segmented button {
  padding: 5px 13px;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--dim);
  background: transparent;
  border: 0;
  border-radius: var(--r-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.segmented button:hover { color: var(--fg); }
.segmented button.is-active { color: var(--fg); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.segmented button.is-warn { color: var(--ember); }
.segmented button.is-warn.is-active { background: color-mix(in srgb, var(--ember) 18%, transparent); }

.filters { margin-bottom: var(--sp-4); overflow-x: auto; }

/* ── Notizen und Gedankengänge ──────────────────────────────────────── */
/* Jeder Gedankenstrang ist EINE Einheit — usenet-artig verschachtelt. */
.notes {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.strand {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.strand--locked { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.strand--locked .note__body { color: var(--dim); }

.note {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--line-soft);
}

.strand > .note:first-child { border-top: 0; }

.note--pending {
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--ember) 8%, transparent), transparent 42%),
    var(--surface);
  box-shadow: inset 3px 0 0 var(--ember);
}

/* Reaktionen: eingerückt mit senkrechter Linie je Ebene. */
.note--reply { background: color-mix(in srgb, var(--bg) 35%, transparent); }

.strand__replies {
  margin-left: var(--sp-4);
  padding-left: var(--sp-4);
  border-left: 1px solid var(--line);
}

.note__reply-to {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: .04em;
  color: var(--faint);
  text-decoration: none;
}

.note__reply-to:hover { color: var(--accent); }

.note__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.note__time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--faint);
  white-space: nowrap;
}

.note__flag {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: .04em;
  color: var(--ember);
}

.note__body {
  max-width: 84ch;
  margin: var(--sp-2) 0 0;
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  color: var(--fg-soft);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.note__link {
  display: inline-block;
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.note__link:hover { text-decoration: underline; }
.note__image-link { display: inline-block; margin-top: var(--sp-2); }

.note__image {
  display: block;
  max-width: min(100%, 460px);
  max-height: 200px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  object-fit: contain;
  background: var(--bg);
}

.note__pending {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--fg-soft);
  background: color-mix(in srgb, var(--ember) 10%, transparent);
  border-radius: var(--r-sm);
}

.note__foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.note__reply:not(:empty) { margin-top: var(--sp-2); }

/* Aktionen einer Notiz: leise Textknöpfe, Löschen analog. */
.note__action {
  padding: 2px 4px;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--dim);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.note__action:hover { color: var(--fg); }
.note__action--danger { color: var(--faint); }
.note__action--danger:hover { color: var(--off); }

.reply { padding-top: var(--sp-1); }
.reply .composer__input { min-height: 48px; font-size: var(--fs-md); }

.reply__bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}

.select--compact {
  width: auto;
  min-width: 118px;
  height: 30px;
  padding-block: 0;
  font-size: var(--fs-sm);
}

.badge--pending {
  border-style: dashed;
  color: var(--ember);
  border-color: color-mix(in srgb, var(--ember) 55%, transparent);
  background: color-mix(in srgb, var(--ember) 8%, transparent);
}

.btn--danger-text { color: var(--off); }
.btn--danger-text:hover { color: var(--off); background: color-mix(in srgb, var(--off) 10%, transparent); }

.notes-empty {
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  color: var(--muted);
}

/* Abgeschlossene Stränge: eine Leiste, eingeklappt. */
.closed-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
}

.closed-bar__label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
}

.closed-bar__label b { color: var(--dim); }

/* ── Gesperrte Stränge ──────────────────────────────────────────────── */
.note--locked { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.note--locked .note__body { color: var(--dim); }

/* ── MCP-Seite ──────────────────────────────────────────────────────── */
.stack-panels { display: flex; flex-direction: column; gap: var(--sp-4); }

.secret-panel { border-color: color-mix(in srgb, var(--ember) 55%, var(--line)); }

.copy-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-3);
}

.code--inline {
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--fg-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  overflow-wrap: anywhere;
}

.token-list { display: flex; flex-direction: column; }

.token-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--line);
}

.token-row:first-child { border-top: 0; }
.token-row__main { min-width: 0; flex: 1 1 auto; }
.token-row.is-revoked { opacity: .55; }

pre.code {
  margin: var(--sp-3) 0;
  padding: var(--sp-4);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
  color: var(--fg-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

/* ── Kleinigkeiten ──────────────────────────────────────────────────── */
.small { font-size: var(--fs-sm); }

@media (max-width: 900px) {
  .rail, .ctx { position: static; }
  .rail-list { max-height: 40vh; }
  .page-title { font-size: var(--fs-xl); }
  .ov-item__stats { margin-left: 0; width: 100%; }
}
