/* Pair-Raum: ruhiges, warmes Erscheinungsbild */
:root {
  --flaeche: #faf9f5;
  --leiste: #f5f4ed;
  --karte: #ffffff;
  --rand: #e8e6dc;
  --rand-stark: #d6d3c6;
  --text: #141413;
  --text-2: #3d3929;
  --leise: #73726c;
  --akzent: #c96442;
  --akzent-dunkel: #ae5630;
  --akzent-hell: #f6e7e0;
  --blase: #f0eee6;
  --gefahr: #b42318;
  --plus-bg: #e7f5ec;
  --plus: #1a6b3c;
  --minus-bg: #fbeaea;
  --minus: #9b2c2c;
  --code-bg: #f5f4ed;
  --gitter: #ebe9e1;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  font-family: var(--sans);
  color: var(--text);
  background: var(--flaeche);
  font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; height: 100vh; overflow: hidden; }
[hidden] { display: none !important; }
a { color: inherit; }
h1 { font-family: var(--serif); font-weight: 500; font-size: 1.75rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); margin: 1.4rem 0 .5rem; }
h3 { font-size: .9rem; font-weight: 600; margin: 1.2rem 0 .5rem; }
button, input, textarea { font: inherit; color: inherit; }
input, textarea { width: 100%; background: var(--karte); border: 1px solid var(--rand-stark); border-radius: 10px; padding: .55rem .7rem; outline: none; }
input:focus, textarea:focus { border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-hell); }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--text-2); }
button { cursor: pointer; border-radius: 10px; border: 1px solid transparent; padding: .5rem .9rem; background: none; }
button:disabled { opacity: .45; cursor: default; }
button.primaer { background: var(--akzent); color: #fff; }
button.primaer:hover:not(:disabled) { background: var(--akzent-dunkel); }
button.zweit { background: var(--karte); border-color: var(--rand-stark); }
button.zweit:hover:not(:disabled) { background: var(--leiste); }
button.gefahr { background: var(--gefahr); color: #fff; }
button.klein { padding: .3rem .65rem; font-size: .82rem; border-radius: 8px; }
.leise { color: var(--leise); }
.klein { font-size: .8rem; }
.fehler { color: var(--gefahr); min-height: 1.2em; margin: 0; font-size: .85rem; }
.zeile { display: flex; gap: .5rem; align-items: center; }
.zeile.rechts { justify-content: flex-end; }
.spalte { display: flex; flex-direction: column; gap: .6rem; }
.marke { font-family: var(--serif); font-size: 1.25rem; text-decoration: none; display: flex; align-items: center; gap: .4rem; }
.funke { color: var(--akzent); }

/* Anmeldung */
.anmeldung { display: grid; place-items: center; height: 100vh; }
.anmeldekarte { width: min(380px, 92vw); display: flex; flex-direction: column; gap: .8rem; background: var(--karte); border: 1px solid var(--rand); border-radius: 16px; padding: 2rem; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.anmeldekarte .marke { font-size: 1.6rem; }

/* Grundgeruest */
.app { display: grid; grid-template-columns: 264px 1fr; height: 100vh; }
.seitenleiste { background: var(--leiste); border-right: 1px solid var(--rand); padding: 1rem .8rem; display: flex; flex-direction: column; min-height: 0; }
.seitenleiste .marke { padding: .2rem .5rem .8rem; }
.neu { text-align: left; background: var(--karte); border: 1px solid var(--rand-stark); margin-bottom: .6rem; }
.neu:hover { border-color: var(--akzent); }
.hauptnav { display: flex; flex-direction: column; }
.hauptnav a, .projektliste a { text-decoration: none; padding: .42rem .6rem; border-radius: 8px; display: block; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hauptnav a:hover, .projektliste a:hover { background: var(--blase); }
.hauptnav a.aktiv, .projektliste a.aktiv { background: #e9e6db; color: var(--text); font-weight: 500; }
.projektliste { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; }
.benutzer { border-top: 1px solid var(--rand); padding-top: .6rem; }
.benutzer summary { list-style: none; display: flex; align-items: center; gap: .5rem; cursor: pointer; padding: .4rem .5rem; border-radius: 8px; }
.benutzer summary::-webkit-details-marker { display: none; }
.benutzer summary:hover { background: var(--blase); }
.benutzermenue { padding: .3rem .4rem .2rem; max-height: 60vh; overflow-y: auto; }
.benutzermenue h3 { margin-top: .6rem; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .75rem; font-weight: 600; background: #e3dccb; color: var(--text-2); flex-shrink: 0; }

.ansicht { min-width: 0; min-height: 0; }
.seite { overflow-y: auto; padding: 2.2rem clamp(1rem, 4vw, 3.5rem); }
.seitenkopf { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; max-width: 1100px; }

/* Projektkarten */
.karten { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; max-width: 1100px; }
.projektkarte { display: flex; flex-direction: column; gap: .5rem; background: var(--karte); border: 1px solid var(--rand); border-radius: 14px; padding: 1.1rem 1.2rem; text-decoration: none; min-height: 140px; transition: border-color .15s, box-shadow .15s; }
.projektkarte:hover { border-color: var(--rand-stark); box-shadow: 0 2px 10px rgba(20,20,19,.05); }
.projektkarte strong { font-family: var(--serif); font-weight: 500; font-size: 1.1rem; }
.projektkarte p { margin: 0; color: var(--leise); font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.projektkarte .fuss { margin-top: auto; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; font-size: .78rem; color: var(--leise); }
.marker { border: 1px solid var(--rand-stark); border-radius: 999px; padding: .05rem .5rem; font-size: .75rem; color: var(--text-2); background: var(--leiste); }
.marker.ok { border-color: #b9dcc6; background: var(--plus-bg); color: var(--plus); }
.marker.warten { border-color: #f1d3a8; background: #fdf4e6; color: #8a5a12; }
.marker.fehlerhaft { border-color: #f0c2c2; background: var(--minus-bg); color: var(--minus); }
.leerzustand { border: 1px dashed var(--rand-stark); border-radius: 14px; padding: 2rem; text-align: center; color: var(--leise); max-width: 1100px; }

/* Projektansicht */
.projekt { display: grid; grid-template-columns: 1fr 400px; height: 100vh; }
.projekt.ohnepanel { grid-template-columns: 1fr 0; }
.projekt.ohnepanel .panel { display: none; }
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.projektkopf { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.2rem; border-bottom: 1px solid var(--rand); background: var(--flaeche); }
.pfad { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pfad a { text-decoration: none; color: var(--leise); }
.pfad strong { font-weight: 500; }
.praesenz { display: flex; margin-left: .4rem; }
.praesenz .avatar { border: 2px solid var(--flaeche); margin-left: -6px; }
.praesenz .avatar:first-child { margin-left: 0; }
.status { margin-left: auto; font-size: .82rem; color: var(--leise); white-space: nowrap; }
.status.aktiv::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--akzent); margin-right: .4rem; animation: puls 1.2s infinite ease-in-out; }
@keyframes puls { 50% { opacity: .3; } }

.verlauf { flex: 1; overflow-y: auto; padding: 1.5rem 1.2rem 1rem; }
.verlauf > * { max-width: 780px; margin-left: auto; margin-right: auto; }
.nachricht { margin-bottom: 1.1rem; }
.nachricht.user { display: flex; flex-direction: column; align-items: flex-end; }
.nachricht.user .wer { font-size: .75rem; color: var(--leise); margin: 0 .3rem .2rem; }
.nachricht.user .blase { background: var(--blase); border-radius: 16px; padding: .6rem .95rem; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.nachricht.user.ich .wer { display: none; }
.nachricht.agent { display: grid; grid-template-columns: 26px 1fr; gap: .7rem; }
.nachricht.agent .kopfzeichen, .entwurf .kopfzeichen { color: var(--akzent); font-size: 1.15rem; line-height: 1.6; text-align: center; }
.nachricht.system { text-align: center; font-size: .8rem; color: var(--leise); }
.nachricht.system span { background: var(--leiste); border-radius: 999px; padding: .25rem .8rem; display: inline-block; }
.turnfuss { font-size: .74rem; color: var(--leise); margin: -.6rem 0 1.1rem 2.4rem; }

/* Markdown */
.markdown { line-height: 1.65; overflow-wrap: anywhere; color: var(--text); }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p { margin: 0 0 .8rem; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { font-family: var(--serif); font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; margin: 1.1rem 0 .5rem; }
.markdown h1 { font-size: 1.35rem; } .markdown h2 { font-size: 1.18rem; } .markdown h3 { font-size: 1.05rem; } .markdown h4 { font-size: .98rem; }
.markdown ul, .markdown ol { margin: 0 0 .8rem; padding-left: 1.4rem; }
.markdown li { margin: .2rem 0; }
.markdown blockquote { margin: 0 0 .8rem; padding-left: .9rem; border-left: 3px solid var(--rand-stark); color: var(--text-2); }
.markdown code { font-family: var(--mono); font-size: .86em; background: var(--code-bg); border: 1px solid var(--rand); border-radius: 5px; padding: .05rem .3rem; }
.markdown hr { border: 0; border-top: 1px solid var(--rand); margin: 1rem 0; }
.markdown table { border-collapse: collapse; margin: 0 0 .8rem; font-size: .9rem; display: block; overflow-x: auto; }
.markdown th, .markdown td { border: 1px solid var(--rand); padding: .35rem .6rem; text-align: left; }
.markdown th { background: var(--leiste); }
.codeblock { border: 1px solid var(--rand); border-radius: 10px; overflow: hidden; margin: 0 0 .8rem; background: var(--code-bg); }
.codeblock .codekopf { display: flex; justify-content: space-between; align-items: center; font-size: .75rem; color: var(--leise); padding: .3rem .6rem; border-bottom: 1px solid var(--rand); }
.codeblock .codekopf button { padding: .1rem .45rem; font-size: .75rem; }
pre { margin: 0; padding: .75rem .9rem; overflow-x: auto; font-family: var(--mono); font-size: .82rem; line-height: 1.5; white-space: pre; }

/* Werkzeugaufrufe */
.werkzeug { border: 1px solid var(--rand); border-radius: 10px; background: var(--karte); margin: 0 0 .7rem 2.4rem; font-size: .86rem; overflow: hidden; }
.werkzeug summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .55rem; padding: .5rem .75rem; }
.werkzeug summary::-webkit-details-marker { display: none; }
.werkzeug summary:hover { background: var(--leiste); }
.werkzeug .wicon { width: 1.2rem; text-align: center; color: var(--leise); }
.werkzeug .wtitel { color: var(--text-2); }
.werkzeug .wziel { font-family: var(--mono); font-size: .8rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.werkzeug .wstat { margin-left: auto; font-family: var(--mono); font-size: .75rem; white-space: nowrap; }
.werkzeug .wkoerper { border-top: 1px solid var(--rand); }
.werkzeug.fehlerhaft { border-color: #f0c2c2; }
.werkzeug .ausgabe { background: #1f1e1d; color: #ecebe6; max-height: 320px; overflow: auto; }
.unterzeile { font-size: .75rem; color: var(--leise); padding: .35rem .75rem; background: var(--leiste); border-bottom: 1px solid var(--rand); }
.plus { color: var(--plus); } .minus { color: var(--minus); }

/* Diff */
.diff { font-family: var(--mono); font-size: .8rem; line-height: 1.5; overflow-x: auto; max-height: 480px; overflow-y: auto; }
.diff div { white-space: pre; padding: 0 .75rem; min-height: 1.5em; }
.diff .d-plus { background: var(--plus-bg); color: var(--plus); }
.diff .d-minus { background: var(--minus-bg); color: var(--minus); }
.diff .d-hunk { color: var(--leise); background: var(--leiste); }
.diff .d-datei { font-weight: 600; background: var(--blase); border-top: 1px solid var(--rand); padding-top: .3rem; padding-bottom: .3rem; }

/* Freigaben, Tippen, Eingabe */
.unten { padding: 0 1.2rem 1rem; }
.unten > * { max-width: 780px; margin-left: auto; margin-right: auto; }
.freigaben { display: flex; flex-direction: column; gap: .6rem; }
.freigabe { border: 1px solid #edc9a8; background: #fdf6ef; border-radius: 14px; padding: .8rem .9rem; margin-bottom: .6rem; }
.freigabe .ftitel { font-weight: 600; margin-bottom: .4rem; }
.freigabe .codeblock { background: var(--karte); }
.freigabe .knoepfe { display: flex; gap: .5rem; flex-wrap: wrap; }
.tippen { min-height: 1.4rem; font-size: .8rem; color: var(--leise); padding: 0 .4rem .3rem; }
.tippen div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tippen b { font-weight: 500; color: var(--text-2); }
.eingabe { background: var(--karte); border: 1px solid var(--rand-stark); border-radius: 18px; padding: .6rem .7rem .5rem 1rem; box-shadow: 0 2px 12px rgba(20,20,19,.04); }
.eingabe:focus-within { border-color: #c9b9a3; }
.eingabe textarea { border: 0; padding: .3rem 0; resize: none; max-height: 240px; box-shadow: none; background: transparent; line-height: 1.5; }
.eingabezeile { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.senden { width: 34px; height: 34px; border-radius: 10px; background: var(--akzent); color: #fff; font-size: 1.05rem; padding: 0; }
.senden:hover:not(:disabled) { background: var(--akzent-dunkel); }

/* Panel */
.panel { border-left: 1px solid var(--rand); background: var(--leiste); display: flex; flex-direction: column; min-height: 0; font-size: .88rem; }
.panel .leise { font-size: .82rem; }
.spalte > button { align-self: flex-start; }
.freigabe .kasten { margin-bottom: .6rem; }
.reiter { display: flex; gap: .2rem; padding: .6rem .7rem 0; border-bottom: 1px solid var(--rand); }
.reiter button { border-radius: 8px 8px 0 0; padding: .45rem .7rem; font-size: .84rem; color: var(--leise); border-bottom: 2px solid transparent; }
.reiter button.aktiv { color: var(--text); border-bottom-color: var(--akzent); }
.reiterinhalt { padding: 1rem; overflow-y: auto; flex: 1; min-height: 0; }
.reiterinhalt h3:first-child { margin-top: 0; }
.blockkopf { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.liste { list-style: none; padding: 0; margin: 0 0 1rem; border: 1px solid var(--rand); border-radius: 10px; background: var(--karte); overflow: hidden; }
.liste li { display: flex; gap: .6rem; align-items: baseline; padding: .45rem .7rem; border-top: 1px solid var(--rand); font-size: .84rem; }
.liste li:first-child { border-top: 0; }
.liste li.klickbar { cursor: pointer; }
.liste li.klickbar:hover { background: var(--leiste); }
.liste .mono { font-family: var(--mono); font-size: .8rem; overflow-wrap: anywhere; }
.kasten { border: 1px solid var(--rand); border-radius: 10px; background: var(--karte); overflow: hidden; margin-bottom: 1rem; }
.schluessel { font-family: var(--mono); font-size: .75rem; overflow-wrap: anywhere; background: var(--karte); border: 1px solid var(--rand); border-radius: 8px; padding: .5rem; user-select: all; }
ol.schritte { padding-left: 1.2rem; font-size: .85rem; margin: .5rem 0; }
ol.schritte li { margin: .25rem 0; }

/* Verbrauch */
.segment { display: inline-flex; border: 1px solid var(--rand-stark); border-radius: 10px; overflow: hidden; background: var(--karte); }
.segment button { border-radius: 0; padding: .4rem .8rem; font-size: .85rem; }
.segment button.aktiv { background: var(--blase); font-weight: 600; }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; max-width: 1100px; margin-bottom: 1rem; }
.kachel { background: var(--karte); border: 1px solid var(--rand); border-radius: 14px; padding: 1rem 1.1rem; }
.kachel .wert { font-family: var(--serif); font-size: 1.7rem; margin-top: .2rem; }
.kachel .bez { font-size: .8rem; color: var(--leise); }
.block { background: var(--karte); border: 1px solid var(--rand); border-radius: 14px; padding: 1rem 1.2rem; max-width: 1100px; margin-bottom: 1rem; }
.block h2 { margin-top: 0; }
.zweispaltig { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; max-width: 1100px; }
.zweispaltig .block { margin-bottom: 0; }
.diagramm { position: relative; }
.diagramm svg { display: block; width: 100%; height: 240px; overflow: visible; }
.diagramm .tooltip { position: absolute; pointer-events: none; background: var(--text); color: #fff; font-size: .78rem; padding: .35rem .55rem; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -110%); }
table.daten { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.daten th, table.daten td { text-align: left; padding: .4rem .3rem; border-bottom: 1px solid var(--rand); }
table.daten th { font-weight: 500; color: var(--leise); }
table.daten td.zahl, table.daten th.zahl { text-align: right; font-variant-numeric: tabular-nums; }

/* Dialog */
dialog { border: 1px solid var(--rand); border-radius: 16px; padding: 1.4rem; width: min(520px, 92vw); background: var(--flaeche); box-shadow: 0 20px 60px rgba(20,20,19,.18); }
dialog::backdrop { background: rgba(20,20,19,.3); }
.dialogtitel { font-family: var(--serif); font-size: 1.35rem; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0 0 .4rem; }

@media (max-width: 1100px) {
  .projekt { grid-template-columns: 1fr; }
  .projekt .panel { position: fixed; right: 0; top: 0; bottom: 0; width: min(400px, 92vw); box-shadow: -10px 0 30px rgba(0,0,0,.08); z-index: 5; }
  .zweispaltig { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .seitenleiste { display: none; }
}
