/* kiassi – MiteinanderWerk Corporate Design v2.1 (Kap. 17 Design-Tokens), Dachmarke MiteinanderWerk: Primär Grün 700 (Kap. 8), Links/Fokus Blau 700 */
@font-face { font-family: "Inter"; src: url("/static/fonts/InterVariable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
:root {
  --mw-green: #6FCF97; --mw-green-dark: #25784E; --mw-green-darker: #205F41;
  --mw-turquoise: #56CCC9; --mw-turquoise-dark: #147C7A;
  --mw-blue: #5B8DEF; --mw-blue-dark: #315EB8; --mw-blue-darker: #274B91;
  --mw-blue-50: #EEF4FE; --mw-blue-100: #DCE8FC; --mw-green-50: #EEF9F2; --mw-green-100: #D8F2E2;
  --mw-text: #2D3748; --mw-text-muted: #64748B; --mw-background: #F8FAFC; --mw-surface: #FFFFFF;
  --mw-surface-muted: #EEF4F7; --mw-border: #CBD5E1;
  --mw-success: #25784E; --mw-info: #315EB8; --mw-warning: #B45309; --mw-error: #B42318; --mw-disabled: #94A3B8;
  --mw-font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --mw-radius-small: 8px; --mw-radius-medium: 10px; --mw-radius-card: 16px; --mw-radius-large: 24px;
  --mw-space-1: 4px; --mw-space-2: 8px; --mw-space-3: 16px; --mw-space-4: 24px; --mw-space-5: 32px; --mw-space-6: 48px;
  --mw-shadow-card: 0 4px 16px rgba(45, 55, 72, 0.08); --mw-shadow-hover: 0 8px 24px rgba(45, 55, 72, 0.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 400 16px/1.6 var(--mw-font); color: var(--mw-text); background: var(--mw-background); }
h1 { font-size: 36px; line-height: 1.2; font-weight: 700; margin: var(--mw-space-3) 0 var(--mw-space-2); }
h2 { font-size: 28px; line-height: 1.2; font-weight: 700; margin: var(--mw-space-3) 0; }
h3 { font-size: 22px; line-height: 1.25; font-weight: 600; margin: 0 0 var(--mw-space-2); }
.hidden { display: none !important; }
.small { font-size: 14px; color: var(--mw-text-muted); }
.center { text-align: center; }
.error { color: var(--mw-error); }
.spacer { flex: 1; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--mw-blue-dark); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Buttons (Kap. 8) */
.button { display: inline-flex; align-items: center; justify-content: center; gap: var(--mw-space-2); min-height: 34px; padding: 6px 14px; border-radius: var(--mw-radius-medium); border: 1px solid var(--mw-green-dark); background: var(--mw-surface); color: var(--mw-green-dark); font: 600 14px/1.3 var(--mw-font); text-decoration: none; cursor: pointer; }
.button:hover { background: var(--mw-green-50); }
.button.primary { background: var(--mw-green-dark); color: #fff; }
.button.primary:hover { background: var(--mw-green-darker); }
.button.danger { border-color: var(--mw-error); color: var(--mw-error); }
.button.danger:hover { background: #FEF3F2; }
.button.wide { width: 100%; }
.button:disabled { background: var(--mw-disabled); border-color: var(--mw-disabled); color: #fff; cursor: default; }
.textbutton { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 var(--mw-space-2); background: none; border: 0; border-radius: var(--mw-radius-small); color: var(--mw-text-muted); font: 600 14px/1.3 var(--mw-font); cursor: pointer; }
.textbutton:hover, .textbutton.active { color: var(--mw-green-dark); background: var(--mw-green-50); }
.textbutton.danger { color: var(--mw-error); }
.textbutton.danger:hover { background: #FEF3F2; }
.iconbutton { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: var(--mw-radius-medium); background: none; color: var(--mw-text-muted); cursor: pointer; }
.iconbutton:hover { background: var(--mw-surface-muted); color: var(--mw-text); }
.iconbutton.danger:hover { color: var(--mw-error); background: #FEF3F2; }

/* Anmelde- und Hinweisseiten */
.screen { display: flex; min-height: 100%; align-items: center; justify-content: center; padding: var(--mw-space-4); }
.card { background: var(--mw-surface); border: 1px solid var(--mw-border); border-radius: var(--mw-radius-card); box-shadow: var(--mw-shadow-card); padding: var(--mw-space-5); max-width: 460px; text-align: center; }
.card .button { margin-top: var(--mw-space-3); }
.mw-line { display: flex; align-items: center; justify-content: center; gap: var(--mw-space-2); color: var(--mw-text-muted); font-size: 14px; margin-top: var(--mw-space-4); }
.mw-line img { width: 24px; height: 24px; }
.avatar-big { width: 112px; height: 112px; border-radius: 50%; }

/* Arbeitsbereich */
#app { display: flex; height: 100%; }
#sidebar { width: 300px; min-width: 260px; background: var(--mw-surface); border-right: 1px solid var(--mw-border); display: flex; flex-direction: column; padding: var(--mw-space-3); gap: var(--mw-space-3); }
.brand { display: flex; align-items: center; gap: 12px; padding: var(--mw-space-1) var(--mw-space-1) 0; }
.brand img { width: 40px; height: 40px; border-radius: 50%; }
.brand strong { display: block; font-size: 18px; line-height: 1.2; }
.brand span { display: block; font-size: 13px; color: var(--mw-text-muted); }
#conversations { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.conv { display: flex; align-items: center; border-radius: var(--mw-radius-small); }
.conv.active { background: var(--mw-green-50); }
.conv:hover { background: var(--mw-surface-muted); }
.conv-title { flex: 1; min-width: 0; min-height: 34px; text-align: left; background: none; border: 0; padding: 0 var(--mw-space-2); cursor: pointer; font: 400 15px/1.3 var(--mw-font); color: var(--mw-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.active .conv-title { font-weight: 600; color: var(--mw-green-darker); }
.conv .iconbutton { width: 28px; height: 28px; opacity: 0; }
.conv:hover .iconbutton, .conv.active .iconbutton, .conv .iconbutton:focus-visible { opacity: 1; }
.empty { color: var(--mw-text-muted); font-size: 14px; padding: var(--mw-space-2); }
.sidebar-foot { display: flex; flex-direction: column; align-items: flex-start; border-top: 1px solid var(--mw-border); padding-top: var(--mw-space-2); }
.sidebar-foot .small { padding: var(--mw-space-1) var(--mw-space-2); }
main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
header { display: flex; align-items: center; gap: var(--mw-space-2); min-height: 52px; padding: 0 var(--mw-space-4); border-bottom: 1px solid var(--mw-border); background: var(--mw-surface); }
#title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#toggle-sidebar { display: none; }
.banner { display: flex; gap: var(--mw-space-3); align-items: center; flex-wrap: wrap; margin: var(--mw-space-3) auto 0; width: calc(100% - 2 * var(--mw-space-4)); max-width: 820px; background: var(--mw-green-50); border: 1px solid var(--mw-green-100); border-radius: var(--mw-radius-card); padding: var(--mw-space-3) var(--mw-space-4); }
.banner p { margin: 0; flex: 1 1 360px; }
#messages { flex: 1; overflow-y: auto; padding: var(--mw-space-4); }
#welcome { max-width: 760px; margin: 6vh auto 0; text-align: center; }
#starters { display: grid; gap: var(--mw-space-2); margin: var(--mw-space-4) 0; }
.starter { min-height: 0; background: var(--mw-surface); border: 1px solid var(--mw-border); border-radius: var(--mw-radius-card); padding: 10px var(--mw-space-3); cursor: pointer; font: 400 15px/1.4 var(--mw-font); color: var(--mw-text); text-align: left; box-shadow: var(--mw-shadow-card); }
.starter:hover { border-color: var(--mw-green-dark); box-shadow: var(--mw-shadow-hover); }
.privacy-note { display: flex; gap: var(--mw-space-2); align-items: flex-start; text-align: left; background: var(--mw-surface-muted); border-radius: var(--mw-radius-card); padding: var(--mw-space-3); font-size: 14px; color: var(--mw-text-muted); }
.privacy-note svg { color: var(--mw-green-dark); margin-top: 2px; }
.msg { max-width: 820px; margin: 0 auto var(--mw-space-3); }
.msg.user .body { background: var(--mw-green-50); border-radius: var(--mw-radius-card); padding: 12px var(--mw-space-3); white-space: pre-wrap; margin-left: 15%; }
.msg.assistant .body { background: var(--mw-surface); border: 1px solid var(--mw-border); border-radius: var(--mw-radius-card); padding: var(--mw-space-2) var(--mw-space-4); box-shadow: var(--mw-shadow-card); max-width: 100%; overflow-x: auto; }
.msg .body p, .msg .body li { max-width: 72ch; }
.msg .body h3, .msg .body h4, .msg .body h5 { font-size: 18px; font-weight: 600; margin: var(--mw-space-3) 0 var(--mw-space-1); }
.msg .body blockquote { border-left: 3px solid var(--mw-border); margin: var(--mw-space-2) 0; padding-left: var(--mw-space-3); color: var(--mw-text-muted); }
.msg .body code { background: var(--mw-surface-muted); border-radius: 4px; padding: 0 4px; }
.msg .meta { display: flex; flex-wrap: wrap; gap: var(--mw-space-1); align-items: center; padding: var(--mw-space-1) 0; }
.msg.user .meta { justify-content: flex-end; }
.msg .attach { display: flex; justify-content: flex-end; gap: 6px; align-items: center; font-size: 14px; color: var(--mw-text-muted); padding-bottom: var(--mw-space-1); }
.sources { font-size: 14px; color: var(--mw-text-muted); padding: var(--mw-space-2) 0 0; }
.sources a { color: var(--mw-blue-dark); }
.typing { display: inline-flex; align-items: baseline; gap: 2px; margin: var(--mw-space-1) 0; font-size: 14px; color: var(--mw-text-muted); }
.dots { display: inline-flex; gap: 3px; margin-left: 2px; }
.dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--mw-text-muted); animation: mw-hop 1.2s infinite ease-in-out; }
.dots span:nth-child(2) { animation-delay: .15s; }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes mw-hop { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots span { animation: mw-fade 1.2s infinite; } @keyframes mw-fade { 50% { opacity: .2; } } }
.msg.editing .body { outline: 2px dashed var(--mw-green-dark); }
#composer { border-top: 1px solid var(--mw-border); background: var(--mw-surface); padding: 12px var(--mw-space-4) var(--mw-space-1); }
#composer .row { display: flex; gap: var(--mw-space-2); align-items: flex-end; max-width: 820px; margin: 0 auto; }
#attachments { max-width: 820px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: var(--mw-space-2); }
#attachments:not(:empty) { margin-bottom: var(--mw-space-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--mw-surface-muted); border-radius: 999px; padding: 4px 4px 4px 12px; font-size: 14px; }
.chip .iconbutton { width: 24px; height: 24px; }
.edit-note { max-width: 820px; margin: 0 auto var(--mw-space-2); display: flex; align-items: center; gap: var(--mw-space-2); font-size: 14px; color: var(--mw-info); }
textarea, input[type=text] { font: 400 16px/1.5 var(--mw-font); color: var(--mw-text); background: #fff; border: 1px solid var(--mw-border); border-radius: var(--mw-radius-small); padding: 11px 12px; }
#input { flex: 1; resize: none; min-height: 40px; max-height: 240px; padding: 8px 12px; }
textarea:focus, input[type=text]:focus { outline: none; border-color: var(--mw-blue-dark); box-shadow: 0 0 0 2px var(--mw-blue-100); }
label.upload { cursor: pointer; }
dialog { border: 1px solid var(--mw-border); border-radius: var(--mw-radius-card); box-shadow: var(--mw-shadow-hover); padding: var(--mw-space-4); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; color: var(--mw-text); }
dialog::backdrop { background: rgba(45, 55, 72, 0.35); }
dialog label.field { display: block; font-weight: 600; margin-top: var(--mw-space-3); }
dialog .help { display: block; font-size: 14px; color: var(--mw-text-muted); margin: 2px 0 var(--mw-space-1); }
dialog textarea, dialog input[type=text] { width: 100%; }
.check { display: flex; align-items: center; gap: var(--mw-space-2); min-height: 32px; }
.check input { width: 16px; height: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--mw-space-2); margin-top: var(--mw-space-4); }
@media (max-width: 860px) {
  #sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--mw-shadow-hover); }
  body.sidebar-open #sidebar { transform: none; }
  #toggle-sidebar { display: inline-flex; }
  header, #messages, #composer { padding-left: 20px; padding-right: 20px; }
  .msg.user .body { margin-left: 5%; }
  h1 { font-size: 30px; }
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* kompakte Schaltfläche „Neue Unterhaltung“ */
.newchat { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; min-height: 32px; padding: 0 12px; border: 1px solid var(--mw-border); border-radius: var(--mw-radius-medium); background: var(--mw-surface); color: var(--mw-text); font: 600 14px/1.3 var(--mw-font); cursor: pointer; }
.newchat:hover { border-color: var(--mw-green-dark); color: var(--mw-green-dark); background: var(--mw-green-50); }
.newchat svg.i { width: 16px; height: 16px; }
/* Menü „⋯“ je Unterhaltung */
.conv { position: relative; }
.menu { position: absolute; right: 4px; top: 40px; z-index: 20; min-width: 220px; background: var(--mw-surface); border: 1px solid var(--mw-border); border-radius: var(--mw-radius-medium); box-shadow: var(--mw-shadow-hover); padding: var(--mw-space-1); display: flex; flex-direction: column; }
.menu .textbutton { justify-content: flex-start; width: 100%; color: var(--mw-text); font-weight: 400; font-size: 15px; }
.menu .textbutton.danger { color: var(--mw-error); }
.conv.menu-open .iconbutton { opacity: 1; }
/* Einstellungen */
dialog hr { border: 0; border-top: 1px solid var(--mw-border); margin: var(--mw-space-4) 0 var(--mw-space-3); }
dialog h4 { font-size: 18px; font-weight: 600; margin: 0 0 var(--mw-space-2); }
.settings-links { display: flex; flex-wrap: wrap; gap: var(--mw-space-2); }
.settings-links .textbutton { color: var(--mw-info); text-decoration: none; }

/* Senden: kompakter runder Knopf */
.sendbutton { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; background: var(--mw-green-dark); color: #fff; cursor: pointer; margin-bottom: 2px; }
.sendbutton:hover { background: var(--mw-green-darker); }
.sendbutton:disabled { background: var(--mw-disabled); cursor: default; }
.sendbutton svg.i { width: 16px; height: 16px; }
/* Aktionen unter Antworten: nur Symbole */
.msg .meta .iconbutton { width: 28px; height: 28px; }
.msg .meta .iconbutton svg.i { width: 15px; height: 15px; }
.msg .meta .iconbutton.active { color: var(--mw-green-dark); background: var(--mw-green-50); }
.msg .meta .textbutton { min-height: 28px; font-size: 13px; font-weight: 400; }
/* Drag & Drop im ganzen Chatbereich */
main { position: relative; }
.dropzone { position: absolute; inset: 8px; z-index: 30; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--mw-green-dark); border-radius: var(--mw-radius-large); background: rgba(238, 249, 242, 0.94); pointer-events: none; }
.dropzone div { display: flex; flex-direction: column; align-items: center; gap: var(--mw-space-2); text-align: center; color: var(--mw-green-darker); }
.dropzone svg.i { width: 32px; height: 32px; }
.dropzone span { font-size: 14px; color: var(--mw-text-muted); }

/* Antwort-Schema */
.msg.assistant .body h3 { font-size: 17px; font-weight: 600; margin: var(--mw-space-3) 0 var(--mw-space-1); padding-left: 10px; border-left: 3px solid var(--mw-green); }
.msg.assistant .body > h3:first-child { margin-top: var(--mw-space-2); }
.callout { display: flex; gap: var(--mw-space-2); align-items: flex-start; margin: var(--mw-space-2) 0; padding: 12px var(--mw-space-3); border-radius: var(--mw-radius-medium); border: 1px solid #F5D0A9; background: #FFF7ED; color: var(--mw-text); }
.callout svg.i { color: var(--mw-warning); margin-top: 2px; }
.callout .label { font-weight: 600; color: var(--mw-warning); margin-right: 4px; }
/* Entwurfskarten */
.draft { margin: var(--mw-space-3) 0; border: 1px solid var(--mw-border); border-radius: var(--mw-radius-card); background: var(--mw-surface); box-shadow: var(--mw-shadow-card); overflow: hidden; }
.draft-head { display: flex; align-items: center; gap: var(--mw-space-2); padding: var(--mw-space-2) var(--mw-space-2) var(--mw-space-2) var(--mw-space-3); background: var(--mw-surface-muted); border-bottom: 1px solid var(--mw-border); }
.draft-head strong { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-head .textbutton { min-height: 28px; font-size: 13px; }
.draft-text { margin: 0; padding: var(--mw-space-3) var(--mw-space-4); font: 400 15px/1.6 var(--mw-font); white-space: pre-wrap; }
.draft .typing { margin: 0 var(--mw-space-4) var(--mw-space-3); }
/* Schreibtool */
.writer { width: min(560px, 45vw); min-width: 360px; display: flex; flex-direction: column; gap: var(--mw-space-2); padding: var(--mw-space-3); background: var(--mw-surface); border-left: 1px solid var(--mw-border); }
.writer-head { display: flex; align-items: center; gap: var(--mw-space-2); min-height: 48px; }
.writer-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#writer-text { flex: 1; resize: none; width: 100%; padding: var(--mw-space-4); font: 400 15px/1.65 var(--mw-font); border-radius: var(--mw-radius-medium); background: #fff; }
.writer-actions { display: flex; flex-wrap: wrap; gap: var(--mw-space-2); align-items: center; }
@media (max-width: 1100px) { .writer { position: fixed; inset: 0 0 0 auto; z-index: 40; width: min(560px, 100vw); min-width: 0; box-shadow: var(--mw-shadow-hover); } }
.prefs { display: flex; flex-direction: column; }

/* Ronny groß oben links, Fußzeile „made by MiteinanderWerk“ */
.brand { flex-direction: column; align-items: center; gap: var(--mw-space-2); padding: var(--mw-space-2) 0 0; text-align: center; }
.brand img { width: 112px; height: 112px; }
.brand strong { font-size: 16px; font-weight: 600; }
.madeby { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 2px 0 4px; font-size: 12px; color: var(--mw-text-muted); }
.madeby img { width: 18px; height: 18px; }
.madeby span { font-weight: 600; color: var(--mw-text); }
.card .madeby { margin-top: var(--mw-space-4); }
.madeby .legal { display: inline-flex; gap: 10px; margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--mw-border); }
.madeby .legal a { color: var(--mw-text-muted); text-decoration: none; }
.madeby .legal a:hover { color: var(--mw-text); text-decoration: underline; }
#composer .small.center { margin: 6px 0 0; font-size: 12px; }
.coupon { font: 600 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; background: #fff; border: 1px dashed var(--mw-green-dark); border-radius: 6px; padding: 1px 6px; }
.avv-card { max-width: 760px; text-align: left; }
.avv-text { max-height: 52vh; overflow-y: auto; border: 1px solid var(--mw-border); border-radius: var(--mw-radius-medium); padding: var(--mw-space-3); margin: var(--mw-space-3) 0; font-size: 14px; background: var(--mw-background); }
.avv-text h3, .avv-text h4, .avv-text h5 { font-size: 15px; margin: var(--mw-space-3) 0 var(--mw-space-1); }
