/* Project Niedersachsen – Entbannungsportal
   Schlicht, grau-blau, ohne Spielereien. Systemschriften, keine externen Dienste. */

:root {
    --bg: #eceff2;
    --surface: #ffffff;
    --surface-2: #f6f7f9;
    --line: #d4d9e0;
    --line-strong: #bcc4cf;
    --text: #1f2630;
    --muted: #5e6a79;
    --blue: #2b5e8c;
    --blue-dark: #214b72;
    --blue-soft: #e4edf5;
    --red: #a23b3b;
    --red-soft: #f7e7e7;
    --green: #2e6f4a;
    --green-soft: #e5f1ea;
    --amber: #8a5a12;
    --amber-soft: #f6eddc;
    --link: #2b5e8c;
    --on-soft: #214b72;
    --hover: #e7eaee;
    --row-hover: #f3f6fa;
    --disc-bg: #e8ebf5;
    --disc-line: #c5cce6;
    --disc-text: #34407a;
    --closed-bg: #e8eaed;
    --team-line: #c1d3e4;
    --red-line: #dcb4b4;
    --green-line: #b6d4c3;
    --viewer-bg: #e3e6ea;
    --radius: 6px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 var(--font);
}

a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--on-soft); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
code { font: .88em var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Kopf & Fuß ---------- */

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header-inner {
    max-width: 1120px; margin: 0 auto; padding: 12px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-logo { height: 40px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 650; }
.brand-sub { font-size: .8rem; color: var(--muted); }

.main-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.main-nav a {
    padding: 7px 12px; border-radius: var(--radius); text-decoration: none; color: var(--text); font-size: .95rem;
}
.main-nav a:hover { background: var(--surface-2); }
.main-nav a.active { background: var(--blue-soft); color: var(--on-soft); font-weight: 600; }
.main-nav a.nav-quiet { color: var(--muted); }

.page { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 28px 20px 48px; }
body.wide .page { max-width: 1120px; }

.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer-inner {
    max-width: 1120px; margin: 0 auto; padding: 16px 20px; display: flex; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; font-size: .875rem; color: var(--muted);
}
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--on-soft); }

/* ---------- Karten, Meldungen ---------- */

.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px; margin-bottom: 20px;
}
.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; margin-top: 24px; }
.card.flush { padding: 0; overflow-x: auto; }
.card.empty { text-align: center; color: var(--muted); padding: 40px 24px; }
.card.empty p { margin: 0; }
.card.side { padding: 18px 20px; }
.card.side h2 { margin-bottom: .75em; }

.intro { margin-bottom: 20px; }
.intro p { color: var(--muted); max-width: 62ch; }
.intro h1 { margin-bottom: .4em; }

.notice {
    border: 1px solid var(--line-strong); background: var(--surface); border-left-width: 4px;
    border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px;
}
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice p:last-child { margin-bottom: 0; }
.notice.error { border-color: var(--red-line); border-left-color: var(--red); background: var(--red-soft); }
.notice.ok { border-color: var(--green-line); border-left-color: var(--green); background: var(--green-soft); }

.ref { font-family: var(--mono); font-size: .92em; font-weight: 600; letter-spacing: .02em; }

/* ---------- Formulare ---------- */

.form .field { margin-bottom: 20px; }
.form label, .form legend { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; padding: 0; }
.form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.form h2 { margin: 28px 0 14px; padding-top: 22px; border-top: 1px solid var(--line); }
.form h2:first-child { margin-top: 0; padding-top: 0; border: 0; }
.opt { font-weight: 400; color: var(--muted); }
.help { margin: 6px 0 0; font-size: .85rem; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], textarea, select {
    width: 100%; font: inherit; color: inherit; background: var(--surface);
    border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 9px 11px;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible, .choice input:focus-visible + span {
    outline: 2px solid var(--blue); outline-offset: 1px;
}
.code-input { font: 1.6rem var(--mono); letter-spacing: .35em; text-align: center; max-width: 12em; }

.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400 !important; cursor: pointer; }
.check input { margin-top: 5px; flex: none; }

.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { display: block; position: relative; margin: 0 !important; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span {
    display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--line-strong);
    border-radius: var(--radius); background: var(--surface); height: 100%;
}
.choice small { color: var(--muted); font-weight: 400; font-size: .85rem; }
.choice:hover span { border-color: var(--blue); }
.choice input:checked + span { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }

.actions { margin-top: 8px; display: flex; gap: 12px; align-items: center; }
.actions.between { justify-content: space-between; flex-wrap: wrap; }

.inline-form { display: flex; gap: 16px; align-items: center; margin-top: 16px; }
.linklike { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font: inherit; font-size: .9rem; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-block; font: inherit; font-size: .95rem; font-weight: 600; text-decoration: none; cursor: pointer;
    padding: 9px 18px; border-radius: var(--radius); border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--text); line-height: 1.3; text-align: center;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); border-color: var(--on-soft); color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--red); border-color: var(--red-line); background: transparent; }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { padding: 5px 11px; font-size: .85rem; }

/* ---------- Markdown-Editor ---------- */

.md-editor { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.md-editor:focus-within { outline: 2px solid var(--blue); outline-offset: 1px; }
.md-head {
    display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
    background: var(--surface-2); border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; padding: 4px 6px;
}
.md-tabs, .md-tools { display: flex; gap: 2px; flex-wrap: wrap; }
.md-tab, .md-tool {
    font: inherit; font-size: .85rem; background: none; border: 1px solid transparent; border-radius: 4px;
    padding: 4px 9px; cursor: pointer; color: var(--muted);
}
.md-tab:hover, .md-tool:hover { background: var(--hover); color: var(--text); }
.md-tab.active { background: var(--surface); border-color: var(--line); color: var(--text); font-weight: 600; }
.md-tools[hidden] { display: none; }
.md-editor textarea { border: 0; border-radius: 0; outline: 0 !important; min-height: 150px; }
.md-preview { padding: 12px 14px; min-height: 150px; }
.md-foot { border-top: 1px solid var(--line); padding: 6px 10px; font-size: .8rem; color: var(--muted); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.md-foot code { font-size: .95em; }

.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .8em; }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.5em; }
.md blockquote { margin: 0 0 .8em; padding: 2px 0 2px 14px; border-left: 3px solid var(--line-strong); color: var(--muted); }
.md pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; }
.md table { border-collapse: collapse; margin-bottom: .8em; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 9px; }
.md h1, .md h2, .md h3 { font-size: 1.05rem; margin: 1em 0 .4em; }
.md img { max-width: 100%; }
.md.plain { white-space: normal; overflow-wrap: anywhere; }
.md { overflow-wrap: anywhere; }

/* ---------- Datei-Upload ---------- */

.dropzone { position: relative; }
.dz-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dz-prompt {
    display: block !important; font-weight: 400 !important; text-align: center; cursor: pointer; margin: 0 !important;
    padding: 22px 16px; border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2);
}
.dz-prompt:hover, .dropzone.over .dz-prompt { border-color: var(--blue); background: var(--blue-soft); }
.dz-prompt .link { color: var(--link); text-decoration: underline; }
.dz-hint { display: block; margin-top: 4px; font-size: .82rem; color: var(--muted); }
.dz-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dz-list:empty { display: none; }
.dz-item {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--line);
    border-radius: var(--radius); background: var(--surface);
}
.dz-thumb { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; background: var(--surface-2); flex: none; border: 1px solid var(--line); }
.dz-ext { width: 36px; height: 36px; border-radius: 4px; flex: none; display: grid; place-items: center; background: var(--blue-soft); color: var(--on-soft); font-size: .65rem; font-weight: 700; }
.dz-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.dz-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.dz-size { font-size: .8rem; color: var(--muted); }
.dz-remove {
    flex: none; background: none; border: 1px solid var(--line); border-radius: 4px; cursor: pointer;
    font: inherit; font-size: .8rem; padding: 4px 9px; color: var(--muted);
}
.dz-remove:hover { color: var(--red); border-color: var(--red-line); background: var(--red-soft); }
.dz-error { margin: 8px 0 0; font-size: .88rem; color: var(--red); }
.dz-error[hidden] { display: none; }

/* ---------- Übersicht ---------- */

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.search { display: flex; gap: 8px; }
.search input { width: 300px; max-width: 100%; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-strong); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a {
    padding: 8px 14px; text-decoration: none; color: var(--muted); border: 1px solid transparent; border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0; margin-bottom: -1px; font-size: .95rem;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--bg); border-color: var(--line-strong); color: var(--text); font-weight: 600; background: var(--surface); border-bottom: 1px solid var(--surface); }
.count { display: inline-block; min-width: 1.6em; padding: 0 6px; margin-left: 4px; text-align: center; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: .78rem; color: var(--muted); }

.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.row-link { cursor: pointer; }
.table tbody tr.row-link:hover td { background: var(--row-hover); }
.table .cell-subject { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table tr.is-off td { color: var(--muted); }
.table .cell-actions { text-align: right; white-space: nowrap; }

.tag { display: inline-block; font-size: .78rem; padding: 1px 8px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--surface-2); white-space: nowrap; }
.tag-discord { background: var(--disc-bg); border-color: var(--disc-line); color: var(--disc-text); }
.tag-ingame { background: var(--blue-soft); border-color: var(--team-line); color: var(--on-soft); }

.status { display: inline-block; font-size: .8rem; font-weight: 600; padding: 1px 9px; border-radius: 10px; white-space: nowrap; }
.status-open { background: var(--amber-soft); color: var(--amber); }
.status-answered { background: var(--blue-soft); color: var(--on-soft); }
.status-closed { background: var(--closed-bg); color: var(--muted); }

/* ---------- Antrag ---------- */

.crumb { margin-bottom: 8px; font-size: .9rem; }
.ticket-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.ticket-head h1 { margin-bottom: 6px; }
.meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0; }
.head-actions { margin: 0; }

.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.side-col { position: sticky; top: 16px; }

.thread { display: flex; flex-direction: column; gap: 14px; margin-bottom: 22px; }
.msg { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; max-width: 92%; }
.msg-requester { align-self: flex-start; }
.msg-team { align-self: flex-end; background: var(--blue-soft); border-color: var(--team-line); }
.msg-head { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 8px; font-size: .84rem; flex-wrap: wrap; }
.msg-who { font-weight: 600; }
.msg-who .muted { font-weight: 400; }

.facts { margin: 0; display: grid; grid-template-columns: 1fr; gap: 0; font-size: .9rem; }
.facts dt { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; margin-top: 12px; }
.facts dt:first-child { margin-top: 0; }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }

/* ---------- Anhänge ---------- */

.attachments { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.att-images { display: flex; flex-wrap: wrap; gap: 10px; }
.att-image { margin: 0; max-width: 100%; }
.att-image a { display: block; line-height: 0; }
.att-image img { max-width: 100%; max-height: 360px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; cursor: zoom-in; }
.att-image figcaption { margin-top: 4px; font-size: .8rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.att-file { display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.msg-team .att-file { border-color: var(--team-line); }
.att-icon { flex: none; width: 40px; height: 40px; border-radius: 4px; display: grid; place-items: center; background: var(--blue-soft); color: var(--on-soft); font-size: .68rem; font-weight: 700; }
.att-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.att-size { font-size: .8rem; color: var(--muted); }
.att-actions { display: flex; gap: 6px; flex: none; }

/* ---------- Vorschau-Dialog ---------- */

.viewer { width: min(1000px, 94vw); height: min(90vh, 900px); padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(25, 32, 42, .6); }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.viewer-title { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-actions { display: flex; gap: 6px; flex: none; }
.viewer-body { flex: 1; min-height: 0; background: var(--viewer-bg); display: flex; align-items: center; justify-content: center; overflow: auto; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }

/* ---------- Benutzer ---------- */

.users-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.menu { position: relative; display: inline-block; text-align: left; }
.menu summary { list-style: none; cursor: pointer; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; width: 240px; padding: 12px;
    background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
    box-shadow: 0 6px 18px rgba(25, 32, 42, .14);
}
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack input { padding: 6px 9px; }

/* ---------- Mobil ---------- */

@media (max-width: 860px) {
    .ticket-layout, .users-layout { grid-template-columns: 1fr; }
    .side-col { position: static; order: -1; }
    .msg { max-width: 100%; }
}

@media (max-width: 640px) {
    body { font-size: 15.5px; }
    .page { padding: 18px 14px 36px; }
    .card { padding: 18px 16px; }
    .grid-2, .choice-row { grid-template-columns: 1fr; }
    .search { width: 100%; }
    .search input { flex: 1; width: auto; }

    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
    .table tr:last-child { border-bottom: 0; }
    .table td { padding: 3px 0; border: 0; display: flex; justify-content: space-between; gap: 12px; }
    .table td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; flex: none; }
    .table .cell-subject { max-width: none; white-space: normal; text-align: right; }
    .table .cell-actions { justify-content: flex-end; }
    .att-file { flex-wrap: wrap; }
    .att-actions { width: 100%; }
    .menu-pop { right: auto; left: 0; }
}

@media (prefers-reduced-motion: no-preference) {
    .btn, .choice span, .dz-prompt, .main-nav a { transition: background-color .12s, border-color .12s, color .12s; }
}

/* ---------- Dunkler Modus (Standard im Team-Bereich) ---------- */

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #14181e;
    --surface: #1b2129;
    --surface-2: #222932;
    --line: #2e3742;
    --line-strong: #435060;
    --text: #e2e6eb;
    --muted: #97a3b1;
    --blue: #3f78ad;
    --blue-dark: #346a9b;
    --blue-soft: #1d3145;
    --link: #7db3e6;
    --on-soft: #a9cdf0;
    --red: #e58080;
    --red-soft: #3a2224;
    --green: #70c493;
    --green-soft: #1e3327;
    --amber: #e3b566;
    --amber-soft: #3a2f1a;
    --hover: #2a323c;
    --row-hover: #1f2832;
    --disc-bg: #262b45;
    --disc-line: #3a4270;
    --disc-text: #aab5f2;
    --closed-bg: #2a313b;
    --team-line: #2f4a63;
    --red-line: #6b3a3d;
    --green-line: #2f5a41;
    --viewer-bg: #0f1216;
}

.theme-form { display: inline; margin: 0; }
.theme-toggle {
    font: inherit; font-size: .88rem; cursor: pointer; color: var(--muted); background: none;
    border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; margin: 0 4px;
}
.theme-toggle:hover { background: var(--hover); color: var(--text); }

/* ---------- Live-Aktualisierung ---------- */

.msg-new { animation: msgflash 2.6s ease-out; }
@keyframes msgflash {
    from { box-shadow: 0 0 0 3px var(--blue); }
    to { box-shadow: 0 0 0 3px transparent; }
}
.live-toast {
    position: fixed; right: 20px; bottom: 20px; z-index: 50; cursor: pointer; font: inherit; font-weight: 600;
    background: var(--blue); color: #fff; border: 0; border-radius: var(--radius); padding: 11px 18px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.live-toast:hover { background: var(--blue-dark); }
@media (prefers-reduced-motion: reduce) { .msg-new { animation: none; } }

/* ---------- Chat-Ansicht eines Antrags ---------- */

.chat-page { height: 100vh; height: 100dvh; }
.chat-page .page { min-height: 0; overflow: hidden; display: flex; flex-direction: column; padding-top: 16px; padding-bottom: 14px; }
.chat-shell { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.chat-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.chat-title { min-width: 0; }
.chat-title h1 { margin: 2px 0 6px; font-size: 1.3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb-back { font-size: .85rem; text-decoration: none; }
.chat-top-actions { display: flex; gap: 8px; align-items: center; }
.chat-top-actions .head-actions { margin: 0; }
.facts-toggle { display: none; }
.chat-shell .notice { margin-bottom: 10px; }

.chat-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; }

.chat {
    position: relative; min-height: 0; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.chat:has(.dropzone.over) { outline: 2px dashed var(--blue); outline-offset: -4px; }

.thread-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.chat .thread {
    flex: 1; min-height: 0; margin: 0; padding: 18px 18px 8px; overflow-y: auto; overscroll-behavior: contain;
    background: var(--bg); gap: 12px;
}
.chat .msg { max-width: 78%; }
.chat .live-toast { position: absolute; left: 50%; right: auto; bottom: 12px; transform: translateX(-50%); }

.composer { flex: none; padding: 10px 14px 12px; background: var(--surface); border-top: 1px solid var(--line); }
.composer .md-foot { display: none; }
.composer .md-editor textarea { min-height: 52px; max-height: 220px; resize: none; }
.composer .md-preview { min-height: 52px; max-height: 220px; overflow-y: auto; }
.composer .dropzone { margin-top: 8px; }
.composer .dz-prompt { padding: 7px 12px; text-align: left; font-size: .88rem; }
.composer .dz-hint { display: none; }
.composer .dz-list { max-height: 96px; overflow-y: auto; }
.composer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.composer-bar .help { margin: 0; flex: 1; min-width: 220px; }
.composer-send { display: flex; align-items: center; gap: 14px; }
.composer-send .check { font-size: .9rem; }

.chat-main .side-col { position: static; min-height: 0; overflow-y: auto; }

@media (max-width: 860px) {
    .chat-main { grid-template-columns: 1fr; }
    .chat-main .side-col { display: none; }
    .chat-main.show-facts .side-col { display: block; }
    .chat-main.show-facts .chat { display: none; }
    .facts-toggle { display: inline-block; }
    .chat .msg { max-width: 92%; }
    .composer-bar .help { display: none; }
    .composer-send { width: 100%; justify-content: space-between; }
    .chat-title h1 { font-size: 1.1rem; }
}
@media (max-width: 640px) {
    .chat-page .page { padding: 10px 10px 8px; }
    .chat-page .site-footer { display: none; }
}

/* Chat: mehr Platz für den Verlauf */
.chat-page .site-footer { display: none; }
.chat-top-actions .btn { padding: 5px 11px; font-size: .85rem; }
@media (max-width: 640px) {
    .chat-page .brand { display: none; }
    .chat-page .site-header-inner { padding: 6px 10px; }
    .chat-title h1 { margin-bottom: 4px; }
    .composer { padding: 8px 10px 10px; }
    .composer .md-tools { display: none; }
    .composer .md-head { padding: 2px 4px; }
    .composer .dz-prompt { padding: 5px 10px; }
}
