/* ══ GC GPT ══════════════════════════════════════════════════════
   Besprechungsraum-Interface. Millimeterpapier, DIN-Schmalschrift,
   ein einziger Akzent in Verkehrsorange.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --flur:      #DEDBD1;  /* Linoleum, Chat-Fläche          */
  --papier:    #FBFAF6;  /* Blatt, Antwortkarte            */
  --tafel:     #222725;  /* dunkles Schiefergrün, Rail     */
  --tafel-2:   #2E3532;
  --tafel-3:   #3C4441;
  --tinte:     #171A19;
  --tinte-2:   #61665F;
  --tinte-3:   #8C9088;
  --linie:     #C6C2B4;
  --orange:    #DC4F1B;
  --orange-2:  #F7E3D9;
  --sand:      #EFEDE5;

  --f-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --f-body:    'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --f-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  --rail-w: 272px;
  --shell:  min(760px, 100%);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--tinte);
  background: var(--flur);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

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

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

.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  height: 100%;
}

/* ── Seitenleiste ────────────────────────────────────────────── */

.rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--tafel);
  color: #D9D6CC;
  border-right: 1px solid #141817;
}

.rail__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
}

.mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  background: var(--orange);
  color: #fff;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .02em;
}

.brand__text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }

.brand__text strong {
  font-family: var(--f-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #F2F0E8;
}

.brand__text em {
  font-style: normal;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--tinte-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-new {
  margin: 0 12px 14px;
  padding: 9px 12px;
  background: transparent;
  color: #E8E5DB;
  border: 1px solid var(--tafel-3);
  border-radius: 2px;
  font-family: var(--f-display);
  font-size: 16px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-new:hover { background: var(--tafel-2); border-color: var(--orange); }
.btn-new span { color: var(--orange); margin-right: 6px; font-weight: 700; }

.rail__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 12px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--tafel-3) transparent;
}

.rail__label {
  margin: 4px 0 8px;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #6E736B;
}

.chats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }

.chats button {
  width: 100%;
  display: block;
  padding: 7px 9px;
  background: none;
  border: 0;
  border-left: 2px solid transparent;
  border-radius: 0 2px 2px 0;
  text-align: left;
  font-size: 13.5px;
  color: #B9B6AC;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chats button:hover { background: var(--tafel-2); color: #E8E5DB; }
.chats li.is-active button {
  background: var(--tafel-2);
  border-left-color: var(--orange);
  color: #F2F0E8;
}

/* Zählwerk — das Herzstück der Seitenleiste */
.counter {
  border-top: 1px solid var(--tafel-3);
  padding: 14px 16px 16px;
  background: #1D2220;
}

.counter__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  color: #7E837A;
}

.counter__row b {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .06em;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
}
.counter__row b.is-zero { color: #4E5450; }

.btn-ghost {
  margin-top: 12px;
  width: 100%;
  padding: 7px;
  background: none;
  border: 1px dashed var(--tafel-3);
  border-radius: 2px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8C9088;
  cursor: pointer;
}
.btn-ghost:hover { color: #E8E5DB; border-color: #6E736B; }

/* ── Hauptbereich ────────────────────────────────────────────── */

.main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
  background:
    repeating-linear-gradient(to right,  rgba(23,26,25,.045) 0 1px, transparent 1px 26px),
    repeating-linear-gradient(to bottom, rgba(23,26,25,.045) 0 1px, transparent 1px 26px),
    var(--flur);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  height: 54px;
  border-bottom: 1px solid var(--linie);
  background: rgba(239,237,229,.82);
  backdrop-filter: blur(6px);
}

.icon-btn {
  display: none;
  padding: 4px 8px;
  background: none;
  border: 1px solid var(--linie);
  border-radius: 2px;
  cursor: pointer;
}

.model { display: flex; align-items: center; gap: 8px; }

.model__label {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--tinte-2);
}

.model select {
  padding: 4px 6px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--tinte);
  border-radius: 0;
  font-family: var(--f-display);
  font-size: 17px;
  letter-spacing: .04em;
  cursor: pointer;
}

.topbar__meta {
  margin: 0 0 0 auto;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--tinte-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stream {
  overflow-y: auto;
  min-height: 0;
  padding: 26px 20px 8px;
  scroll-behavior: smooth;
}

.thread {
  width: var(--shell);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ── Leerer Zustand ──────────────────────────────────────────── */

.empty {
  width: var(--shell);
  margin: 4vh auto 0;
  padding-bottom: 40px;
}

.empty__eyebrow {
  margin: 0 0 18px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--orange);
}

.empty__head {
  margin: 0 0 20px;
  font-family: var(--f-display);
  font-size: clamp(52px, 11vw, 96px);
  font-weight: 600;
  line-height: .88;
  letter-spacing: -.01em;
  text-transform: uppercase;
}
.empty__head span {
  position: relative;
  color: var(--orange);
}
.empty__head span::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: .1em;
  height: 3px;
  background: var(--orange);
  transform-origin: left;
  animation: rule 1.1s .3s cubic-bezier(.2,.8,.2,1) backwards;
}
@keyframes rule { from { transform: scaleX(0); } }

.empty__sub {
  max-width: 46ch;
  margin: 0 0 26px;
  color: var(--tinte-2);
  font-size: 15px;
}

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }

.chips button {
  padding: 8px 13px;
  background: var(--papier);
  border: 1px solid var(--linie);
  border-radius: 2px;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.chips button:hover {
  border-color: var(--orange);
  transform: translateY(-1px);
}

/* ── Nachrichten ─────────────────────────────────────────────── */

.msg { display: flex; gap: 12px; animation: rise .32s cubic-bezier(.2,.8,.2,1) backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.msg__av {
  flex: 0 0 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  margin-top: 2px;
}

.msg--gc .msg__av { background: var(--orange); color: #fff; }
.msg--me .msg__av { background: var(--tafel); color: #E8E5DB; }

.msg__body { min-width: 0; flex: 1 1 auto; }

/* Eigene Beiträge stehen rechts — sie sind die kurzen. */
.msg--me { flex-direction: row-reverse; }
.msg--me .msg__body { flex: 0 1 auto; max-width: 80%; }
.msg--me .msg__head { flex-direction: row-reverse; }
.msg--me .msg__time { margin: 0; }

.msg__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 5px;
}

.msg__who {
  font-family: var(--f-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.msg__role, .msg__time {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: .08em;
  color: var(--tinte-3);
  text-transform: uppercase;
}
.msg__time { margin-left: auto; }

.msg__text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg--gc .msg__text {
  background: var(--papier);
  border: 1px solid var(--linie);
  border-left: 3px solid var(--orange);
  border-radius: 0 3px 3px 0;
  padding: 13px 16px;
  box-shadow: 0 1px 0 rgba(23,26,25,.05);
}

.msg--me .msg__text {
  background: var(--sand);
  border: 1px solid var(--linie);
  border-radius: 3px;
  padding: 11px 14px;
  color: #2A2E2C;
}

/* laufende Auslassungspunkte */
.dots { color: var(--orange); font-weight: 600; }
.dots span { animation: blink 1.5s infinite; }
.dots span:nth-child(2) { animation-delay: .22s; }
.dots span:nth-child(3) { animation-delay: .44s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

.caret {
  display: inline-block;
  width: 7px;
  height: 1em;
  vertical-align: -.13em;
  background: var(--orange);
  animation: caret .8s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* Informationsgehalt-Messung unter jeder Antwort */
.gauge {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 7px;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--tinte-3);
}

.gauge__track {
  flex: 0 0 110px;
  height: 4px;
  background: rgba(23,26,25,.1);
  overflow: hidden;
}

.gauge__fill {
  height: 100%;
  background: var(--orange);
  transform-origin: left;
  animation: fill .7s cubic-bezier(.2,.8,.2,1) backwards;
}
@keyframes fill { from { transform: scaleX(0); } }

/* Denk-Protokoll (GC-o1) */
.think {
  font-family: var(--f-mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--tinte-2);
  background: rgba(23,26,25,.035);
  border-left: 2px solid var(--linie);
  padding: 9px 12px;
  margin-bottom: 9px;
}
.think p { margin: 0; opacity: .55; }
.think p:last-child { opacity: 1; color: var(--tinte); }

/* Tippanzeige */
.typing { display: flex; align-items: center; gap: 8px; color: var(--tinte-2); font-size: 13.5px; }
.typing i { font-style: normal; display: flex; gap: 3px; }
.typing i b {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--orange); animation: bob 1.1s infinite;
}
.typing i b:nth-child(2) { animation-delay: .16s; }
.typing i b:nth-child(3) { animation-delay: .32s; }
@keyframes bob { 0%, 70%, 100% { opacity: .25; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }

/* ── Eingabe ─────────────────────────────────────────────────── */

.composer {
  padding: 10px 20px 16px;
  border-top: 1px solid var(--linie);
  background: rgba(239,237,229,.9);
  backdrop-filter: blur(6px);
}

.composer__box {
  width: var(--shell);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px 7px 7px 14px;
  background: var(--papier);
  border: 1px solid var(--tinte-2);
  border-radius: 3px;
  transition: border-color .15s, box-shadow .15s;
}
.composer__box:focus-within {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(220,79,27,.14);
}

.composer__box textarea {
  flex: 1 1 auto;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  max-height: 168px;
  padding: 6px 0;
  font-size: 15px;
  line-height: 1.5;
}

.send {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--orange);
  color: #fff;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.send:hover { background: #C24415; }
.send:disabled { opacity: .3; cursor: not-allowed; }

.composer__hint {
  width: var(--shell);
  margin: 8px auto 0;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: .06em;
  color: var(--tinte-3);
}
.composer__hint span { color: var(--tinte-2); }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(23,26,25,.45);
  z-index: 8;
  border: 0;
}

/* ── Schmale Ansicht ─────────────────────────────────────────── */

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }

  .rail {
    position: fixed;
    z-index: 9;
    top: 0; bottom: 0; left: 0;
    width: var(--rail-w);
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.2,.8,.2,1);
  }
  .app.rail-open .rail { transform: none; }

  .icon-btn { display: block; }
  .topbar__meta { display: none; }
  .stream { padding-inline: 14px; }
  .composer { padding-inline: 14px; }
  .composer__hint span { display: none; }
  .empty { margin-top: 2vh; }
  .msg--me .msg__body { max-width: 88%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .stream { scroll-behavior: auto; }
}
