:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --text: #1d2733;
  --muted: #5d6875;
  --line: #dde3e9;
  --accent: #2e5c86;
  --accent-text: #ffffff;
  --assistant: #eef2f6;
  --warn-bg: #fff6e5;
  --warn-text: #7a4b00;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
/* Fast højde: kun beskedlisten ruller, så indtastningsfeltet altid er synligt. */
body { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }

.banner {
  margin: 0;
  padding: 8px 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--warn-text);
  background: var(--warn-bg);
  border-bottom: 1px solid #f0dcb4;
}

.chat {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.chat-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600; font-size: 0.9rem;
  color: var(--accent-text); background: var(--accent);
}
h1 { margin: 0; font-size: 1.1rem; }
.subtitle { margin: 2px 0 0; font-size: 0.85rem; color: var(--muted); }
.intro { margin: 0; padding: 12px 20px; font-size: 0.85rem; color: var(--muted); border-bottom: 1px solid var(--line); }

.messages { flex: 1; min-height: 0; margin: 0; padding: 20px; list-style: none; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: var(--radius); line-height: 1.45; }
.msg .body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .meta { margin: 6px 0 0; font-size: 0.75rem; opacity: 0.8; }
.msg.guest { align-self: flex-end; color: var(--accent-text); background: var(--accent); border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--assistant); border-bottom-left-radius: 4px; }
.msg.pending .body { color: var(--muted); font-style: italic; }
.badge {
  display: inline-block; margin-top: 8px; padding: 2px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; color: var(--warn-text); background: var(--warn-bg);
}

.notice { margin: 0 20px 12px; padding: 10px 14px; border-radius: 10px; font-size: 0.9rem; color: var(--warn-text); background: var(--warn-bg); }

.composer { padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.channel { display: flex; gap: 16px; margin: 0 0 10px; padding: 0; border: 0; font-size: 0.85rem; color: var(--muted); }
.channel legend { float: left; margin-right: 8px; }
.channel[hidden] { display: none; }
.channel label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.input-row { display: flex; gap: 10px; align-items: flex-end; }
textarea {
  flex: 1; resize: none; min-height: 44px; padding: 10px 12px;
  font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 10px;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
button {
  min-width: 96px; min-height: 44px; padding: 0 18px;
  font: inherit; font-weight: 600; color: var(--accent-text); background: var(--accent);
  border: 0; border-radius: 10px; cursor: pointer;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.hint { margin: 8px 0 0; font-size: 0.75rem; color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 600px) {
  .chat { border: 0; }
  .chat-header, .intro, .messages, .composer { padding-left: 16px; padding-right: 16px; }
  .msg { max-width: 90%; }
  button { min-width: 72px; }
}

/* --- Teknisk visning (kun body.tech og egne klasser; gæstechatten er uændret) ------------------------------------ */
body.tech { height: auto; min-height: 100vh; }
.tech-header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; padding: 16px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.facts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; }
.facts div { min-width: 110px; }
.facts dt, .kv dt { font-size: 0.75rem; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.tech-notice { margin: 12px 24px 0; }
.tech-layout { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; padding: 16px 24px; align-items: start; }
.tech-side, .tech-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card h2 { margin: 0 0 12px; font-size: 1rem; }
.card label { display: block; margin: 12px 0 4px; font-size: 0.85rem; color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.row select { flex: 1 1 0; min-width: 0; }
.row button { flex: 0 0 auto; }
.login { width: 100%; max-width: 360px; margin: 48px auto; }
.login input { width: 100%; min-height: 40px; padding: 0 10px; font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 8px; }
select { flex: 1; min-height: 40px; padding: 0 8px; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
button.secondary { color: var(--accent); background: transparent; border: 1px solid var(--accent); }
.warn { margin: 0; padding: 8px 10px; font-size: 0.8rem; border-radius: 8px; color: var(--warn-text); background: var(--warn-bg); }
.note { margin: 10px 0 0; font-size: 0.85rem; color: var(--muted); }
.empty { margin: 0; color: var(--muted); font-size: 0.9rem; }
.link-out { margin: 10px 0 0; font-size: 0.85rem; overflow-wrap: anywhere; }
.link-out a { color: var(--accent); }
.msg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.msg-item {
  width: 100%; min-height: 0; display: grid; grid-template-columns: 24px 1fr auto; gap: 2px 8px; padding: 8px 10px;
  text-align: left; font-weight: 400; color: var(--text); background: var(--bg); border: 1px solid transparent; border-radius: 10px;
}
.msg-item.active { border-color: var(--accent); background: var(--assistant); }
.msg-item .n { grid-row: span 2; font-weight: 600; color: var(--muted); }
.msg-item .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.msg-item .meta { grid-column: 2; font-size: 0.75rem; color: var(--muted); }
.msg-item .status { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
.status { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: var(--line); color: var(--text); }
.status.pass { background: #e3f3e8; color: #1e6b37; }
.status.done { background: #e3f3e8; color: #1e6b37; }
.status.failed, .status.fail, .status.aborted, .status.error { background: #fbe4e4; color: #8a1f1f; }
.status.processing { background: var(--warn-bg); color: var(--warn-text); }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail-head h2 { margin: 0; font-size: 1.15rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.kv { display: grid; grid-template-columns: minmax(140px, 36%) 1fr; gap: 6px 12px; margin: 0; }
.kv dd { margin: 0; font-size: 0.9rem; overflow-wrap: anywhere; }
.tl { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.tl th { text-align: left; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px 8px; }
.tl td { vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.tl td:first-child { white-space: nowrap; color: var(--muted); }
.mark { display: inline-block; min-width: 1.6em; padding: 0 4px; border-radius: 4px; text-align: center; font-size: 0.72rem; font-weight: 700; }
.mark.m { background: #e3f3e8; color: #1e6b37; }
.mark.a { background: #e6eef7; color: #24507a; }
.mark.k { background: #efe8f7; color: #5a3488; }
.mark.i { background: #eeeeee; color: #555555; }
.ok { color: #1e6b37; font-weight: 700; }
.bad { color: #8a1f1f; font-weight: 700; }
blockquote { margin: 0 0 12px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--assistant); border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.legend { margin: 0; padding: 0 24px 24px; font-size: 0.8rem; color: var(--muted); }

@media (max-width: 900px) {
  .tech-layout { grid-template-columns: 1fr; padding: 12px 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .tech-header { padding: 12px 16px; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
  .tl { font-size: 0.8rem; }
  .legend { padding: 0 16px 16px; }
}
