/* #4: Detail-Leiste (Breite ziehbar, Bearbeiten, Markdown, Kommentare), Zahnrad-Warnpunkt. Farben nur ueber var() aus :root. */
.detail { position: relative; display: flex; padding: 0; overflow: hidden; min-width: 320px; max-width: 100vw; }
.detail-scroll { flex: 1 1 auto; min-width: 0; overflow: auto; padding: 16px 20px 28px; }
.detail-resize { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; z-index: 2; cursor: col-resize; touch-action: none; }
.detail-resize::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: transparent; transition: background .12s; }
.detail-resize:hover::after, .detail-resize:focus-visible::after, body.resizing .detail-resize::after { background: var(--brand); }
.detail-resize:focus-visible { outline: none; }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none; }
.detail-tools { display: flex; align-items: center; gap: 4px; }
.detail-tools .btn { height: 30px; padding: 0 10px; }
.detail-tools .btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.detail h3 { margin: 22px 0 8px; }

/* Markdown (bereinigtes body_html von GitHub) */
.detail-body, .comment { white-space: normal; }
.md { line-height: 1.55; overflow-wrap: anywhere; color: var(--text); }
.md.md-plain { white-space: pre-wrap; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md table, .md details { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { color: var(--text-strong); line-height: 1.3; margin: 16px 0 8px; }
.md h1 { font-size: 18px; } .md h2 { font-size: 16px; } .md h3, .md h4, .md h5, .md h6 { font-size: 14px; }
.md ul, .md ol { padding-left: 22px; }
.md li:has(> input[type="checkbox"]) { list-style: none; margin-left: -18px; }
.md li > input[type="checkbox"] { margin: 0 6px 0 0; vertical-align: -2px; }
.md a { color: var(--link); }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--lozenge-bg); border-radius: 3px; padding: 1px 4px; }
.md pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; overflow-x: auto; }
.md pre code { background: transparent; padding: 0; }
.md blockquote { border-left: 3px solid var(--chip-border); padding: 2px 0 2px 12px; color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.md table { border-collapse: collapse; display: block; max-width: 100%; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 8px; }
.md th { color: var(--text-strong); background: var(--card); }
.md img { max-width: 100%; height: auto; border-radius: 4px; vertical-align: middle; }
.md kbd { border: 1px solid var(--chip-border); border-bottom-width: 2px; border-radius: 3px; padding: 0 4px; font-size: 12px; }
.md-img-fallback { display: inline-block; border: 1px dashed var(--chip-border); border-radius: 4px; padding: 4px 8px; color: var(--muted); font-size: 12px; text-decoration: none; }
a.md-img-fallback { color: var(--link); }

/* Kommentare wie Jira: Avatar links, Name fett + Zeit gedaempft, Inhalt als abgesetzter Block */
.comments { display: grid; gap: 16px; }
.comment { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: start; border: 0; padding: 0; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--lozenge-bg); object-fit: cover; }
.comment-avatar.initial { display: grid; place-items: center; color: var(--text-strong); font-weight: 600; font-size: 13px; }
.comment-main { min-width: 0; display: grid; gap: 6px; }
.comment-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.comment-head strong { color: var(--text-strong); font-weight: 600; }
.comment-head time { color: var(--muted); font-size: 12px; }
.comment-body { background: var(--card); border: 1px solid var(--card-border); border-radius: 6px; padding: 8px 12px; }

/* Neuer Kommentar */
.comment-form { display: grid; gap: 8px; margin-top: 16px; }
.comment-form .field textarea { min-height: 96px; }
.comment-form textarea:disabled { background: var(--disabled-bg); color: var(--disabled-text); cursor: not-allowed; }

/* Bilder einfuegen/ziehen in Markdown-Feldern */
.field textarea.drop-over { outline: 2px dashed var(--brand); outline-offset: 2px; }
.field textarea[aria-busy="true"] { cursor: progress; }

/* Bearbeiten in der Detail-Leiste */
.edit-form { display: grid; gap: 14px; margin-top: 8px; }
.edit-form h3 { margin: 4px 0 0; }
.edit-form .field textarea { min-height: 180px; }
.edit-form .segmented { gap: 4px; }

/* Settings: Zahnrad in der Rail (Warnpunkt ohne Token), Ansicht selbst in css/settings.css */
.rail-btn { position: relative; }
#open-settings.warn::after { content: ""; position: absolute; top: 6px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn-text); box-shadow: 0 0 0 2px var(--rail-bg); }
