/* Panel – vier Plätze an einem Tisch. Jede Perspektive hat eine Farbe; alles andere bleibt ruhig.
   Bedienung in Bricolage Grotesque, Antworten in Source Serif 4 (liest sich wie ein schriftliches Gutachten). */
:root {
  --paper: #EEF0EC;
  --sheet: #FBFBF8;
  --ink: #1B2320;
  --muted: #5C6863;
  --rule: #D5DAD3;
  --seat-A: #2B6C8C;
  --seat-B: #9C2F67;
  --seat-C: #5F7317;
  --seat-D: #A06E0A;
  --flag: #B3261E;
  --flag-soft: #F8E6E4;
  --focus: #2B6C8C;
  --side: 272px;
  --col: 740px;
  --ui: "Bricolage Grotesque", system-ui, sans-serif;
  --read: "Source Serif 4", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141917; --sheet: #1C2220; --ink: #E7EBE6; --muted: #9AA59F; --rule: #2E3632;
    --seat-A: #6FB3D4; --seat-B: #E27BB1; --seat-C: #A8C25A; --seat-D: #E3B04B;
    --flag: #FF8A80; --flag-soft: #3A2422; --focus: #6FB3D4; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141917; --sheet: #1C2220; --ink: #E7EBE6; --muted: #9AA59F; --rule: #2E3632;
  --seat-A: #6FB3D4; --seat-B: #E27BB1; --seat-C: #A8C25A; --seat-D: #E3B04B;
  --flag: #FF8A80; --flag-soft: #3A2422; --focus: #6FB3D4; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); }
body { font-family: var(--ui); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

.s-A { --c: var(--seat-A); } .s-B { --c: var(--seat-B); } .s-C { --c: var(--seat-C); } .s-D { --c: var(--seat-D); }

/* ---------------------------------------------------------------- Wortmarke */
.wordmark { font-weight: 800; font-size: clamp(2.8rem, 8vw, 4.2rem); letter-spacing: -0.035em; line-height: .9; margin: 0; }
.wordmark.small { font-size: 1.35rem; letter-spacing: -0.02em; }
.seatmark { display: grid; grid-template-columns: repeat(2, 14px); gap: 6px; margin-bottom: 18px; }
.seatmark i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); display: block; }

/* ---------------------------------------------------------------- Buttons & Formulare */
.btn { border: 1px solid var(--rule); background: var(--sheet); border-radius: 10px; padding: .6rem 1rem; font-weight: 600; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; padding: .25rem 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; text-align: left; }
.link:hover { text-decoration-color: var(--ink); }
.icon-btn { background: none; border: 0; width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; font-size: 1.25rem; color: var(--muted); }
.icon-btn:hover { background: var(--paper); color: var(--ink); }
.form { display: grid; gap: .85rem; }
.form label { display: grid; gap: .3rem; font-size: .9rem; font-weight: 600; }
.form input, .drawer input { border: 1px solid var(--rule); background: var(--sheet); border-radius: 10px; padding: .65rem .8rem; font-weight: 400; }
.hint { font-size: .82rem; color: var(--muted); margin: 0; }
.error { color: var(--flag); font-size: .9rem; }
.lang-switch { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.lang-switch button { background: none; border: 0; padding: .2rem .55rem; font-size: .8rem; font-weight: 700; color: var(--muted); }
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); }

/* ---------------------------------------------------------------- Anmeldung */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); position: relative; }
.auth-card .lang-switch { position: absolute; right: 0; top: 0; }
.auth-sub { color: var(--muted); margin: 14px 0 26px; max-width: 34ch; }
.tabs { display: flex; gap: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--rule); }
.tabs button { background: none; border: 0; padding: .5rem 0; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--ink); }

/* ---------------------------------------------------------------- Layout */
.app { display: grid; grid-template-columns: var(--side) 1fr; height: 100%; }
.sidebar { border-right: 1px solid var(--rule); background: var(--paper); display: flex; flex-direction: column; padding: 18px 14px; gap: 14px; min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.new-chat { width: 100%; text-align: left; }
.conv-list { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; min-height: 0; }
.conv-list button { background: none; border: 0; text-align: left; padding: .5rem .6rem; border-radius: 8px; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.conv-list button:hover { background: var(--sheet); }
.conv-list button[aria-current="true"] { background: var(--sheet); font-weight: 600; box-shadow: inset 2px 0 0 var(--ink); }
.side-foot { display: grid; gap: .4rem; justify-items: start; border-top: 1px solid var(--rule); padding-top: 12px; }
.who { font-size: .8rem; color: var(--muted); margin: .3rem 0 0; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--sheet); }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--rule); min-height: 54px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .82rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); display: inline-block; }
.mode-badge { margin-left: auto; font-size: .75rem; font-weight: 700; border: 1px solid var(--rule); border-radius: 999px; padding: .1rem .55rem; color: var(--muted); }
.only-mobile { display: none; }

.thread { flex: 1; overflow-y: auto; padding: 28px 20px 12px; }
.thread > * { max-width: var(--col); margin-left: auto; margin-right: auto; }

/* ---------------------------------------------------------------- Leerer Zustand: der Tisch */
.empty { flex: 1; overflow-y: auto; padding: 48px 20px 24px; }
.empty > * { max-width: var(--col); margin-left: auto; margin-right: auto; }
.empty h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); letter-spacing: -0.02em; line-height: 1.1; margin: 36px auto 8px; }
.empty p { margin-top: 0; }
.empty .lead span { display: block; max-width: 58ch; }
.table { position: relative; padding-top: 30px; }
.table::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 12px; border-radius: 12px; background: var(--ink); opacity: .9; }
.seats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.seat { border-top: 4px solid var(--c); padding-top: 10px; }
.seat b { display: block; font-size: 1rem; line-height: 1.2; }
.seat small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.35; margin-top: 4px; }
.seat .name { color: var(--c); font-weight: 600; font-size: .8rem; margin-top: 6px; display: block; }
.starters { display: grid; gap: 8px; margin-top: 22px; }
.starters button { text-align: left; background: var(--paper); border: 1px solid transparent; border-radius: 12px; padding: .75rem .9rem; font-size: .95rem; }
.starters button:hover { border-color: var(--rule); background: var(--sheet); }

/* ---------------------------------------------------------------- Nachrichten */
.msg { margin-bottom: 30px; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble { background: var(--paper); border-radius: 16px 16px 4px 16px; padding: .7rem 1rem; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user .att { display: block; font-size: .8rem; color: var(--muted); margin-top: .35rem; }
.answer { font-family: var(--read); font-size: 1.06rem; line-height: 1.7; overflow-wrap: anywhere; }
.answer h1, .answer h2, .answer h3 { font-family: var(--ui); letter-spacing: -0.01em; line-height: 1.25; margin: 1.3em 0 .4em; }
.answer h2 { font-size: 1.25rem; } .answer h3 { font-size: 1.08rem; }
.answer p { margin: 0 0 .85em; }
.answer strong { font-weight: 650; }
.answer ul, .answer ol { padding-left: 1.3em; margin: 0 0 .9em; }
.answer li { margin-bottom: .3em; }
.answer blockquote { margin: 0 0 1em; padding: .2em 0 .2em 1em; border-left: 3px solid var(--rule); color: var(--muted); }
.answer code { font-size: .9em; background: var(--paper); padding: .1em .3em; border-radius: 4px; }
.answer pre { background: var(--paper); padding: .8em 1em; border-radius: 10px; overflow-x: auto; white-space: pre-wrap; font-family: var(--read); }
.cite { font-family: var(--ui); font-size: .68rem; font-weight: 700; vertical-align: super; line-height: 0; margin-left: 1px; border: 0; background: none; padding: 0 1px; color: var(--c, var(--muted)); cursor: pointer; }
.cite:hover { text-decoration: underline; }
.caret::after { content: ""; display: inline-block; width: .5em; height: 1em; background: var(--ink); opacity: .6; vertical-align: -0.12em; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Der Sitzplan unter jeder Antwort – das Erkennungszeichen */
.answer-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 10px; font-family: var(--ui); font-size: .82rem; color: var(--muted); }
.seatplan { display: inline-flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--rule); border-radius: 999px; padding: .28rem .7rem .28rem .5rem; color: var(--muted); }
.seatplan:hover { border-color: var(--ink); color: var(--ink); }
.seatplan .dots { display: inline-grid; grid-template-columns: repeat(4, 10px); gap: 4px; }
.seatplan .dots i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--c); display: block; }
.seatplan .dots i.on { background: var(--c); }
.verify { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; color: var(--muted); }
.verify.warn { color: var(--flag); }
.retry { color: var(--flag); }
.status-line { font-family: var(--ui); font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.err-box { background: var(--flag-soft); color: var(--flag); border-radius: 10px; padding: .7rem .9rem; font-family: var(--ui); font-size: .92rem; }

/* ---------------------------------------------------------------- Eingabe */
.composer { border-top: 1px solid var(--rule); padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: var(--sheet); }
.composer > * { max-width: var(--col); margin-left: auto; margin-right: auto; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--rule); border-radius: 14px; padding: 6px; background: var(--sheet); }
.composer-row:focus-within { border-color: var(--ink); }
.composer textarea { flex: 1; border: 0; resize: none; background: transparent; padding: .45rem .3rem; max-height: 40vh; outline: none; line-height: 1.45; }
.send { padding: .5rem .9rem; }
.composer-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin-top: 6px; font-size: .85rem; }
.files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--paper); border-radius: 999px; padding: .2rem .4rem .2rem .7rem; font-size: .82rem; }
.chip button { background: none; border: 0; color: var(--muted); font-size: 1rem; line-height: 1; padding: 0 .2rem; }

/* ---------------------------------------------------------------- Drawer */
.drawer { position: fixed; inset: 0; background: rgba(20, 25, 23, .35); display: flex; justify-content: flex-end; z-index: 20; }
.drawer-panel { width: min(520px, 100%); height: 100%; background: var(--sheet); border-left: 1px solid var(--rule); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--rule); }
.drawer-head h3 { margin: 0; font-size: 1.1rem; }
.drawer-body { overflow-y: auto; padding: 16px 18px 40px; display: grid; gap: 14px; align-content: start; }
.src { border-left: 3px solid var(--c); padding: 2px 0 2px 12px; }
.src .meta { font-size: .78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.src .meta b { color: var(--c); }
.src h4 { margin: .2rem 0; font-size: .98rem; }
.src p { margin: .2rem 0; font-family: var(--read); font-size: .95rem; }
.src q { display: block; font-family: var(--read); font-style: italic; color: var(--muted); font-size: .92rem; margin-top: .3rem; }
.src a { color: var(--ink); font-size: .82rem; }
.src.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--paper); } to { background: transparent; } }
.filter { display: flex; flex-wrap: wrap; gap: 6px; }
.filter button { border: 1px solid var(--rule); background: none; border-radius: 999px; padding: .15rem .6rem; font-size: .8rem; display: inline-flex; gap: 6px; align-items: center; }
.filter button i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; }
.filter button[aria-pressed="true"] { border-color: var(--ink); font-weight: 700; }
.concepts { display: flex; flex-wrap: wrap; gap: 6px; }
.concepts button { border: 1px solid var(--rule); background: var(--paper); border-radius: 8px; padding: .25rem .55rem; font-size: .85rem; }
.concepts button small { color: var(--muted); margin-left: 4px; }
.box { border: 1px solid var(--rule); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.box h4 { margin: 0; }
.box ol { margin: 0; padding-left: 1.2em; }
.prompt-pre { white-space: pre-wrap; font-size: .78rem; background: var(--paper); border-radius: 8px; padding: 10px; max-height: 220px; overflow: auto; margin: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-size: .9rem; }
.stat-grid div { border-left: 3px solid var(--c, var(--rule)); padding-left: 8px; }
.switch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.switch-row button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
.code-out { font-size: 1.3rem; font-weight: 800; letter-spacing: .04em; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: var(--sheet); padding: .5rem 1rem; border-radius: 10px; font-size: .9rem; z-index: 30; }

/* ---------------------------------------------------------------- Mobil */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 15; transform: translateX(-100%); transition: transform .2s ease; background: var(--paper); }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(20, 25, 23, .35); }
  .only-mobile { display: inline-grid; }
  .wordmark.only-mobile { display: inline; }
  .thread, .empty { padding-left: 16px; padding-right: 16px; }
  .composer { padding-left: 12px; padding-right: 12px; }
  .topbar { padding: 8px 12px; }
  .seats { grid-template-columns: repeat(2, 1fr); row-gap: 18px; }
  .legend { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
