:root {
  --ink: #17313b;
  --muted: #5d7480;
  --line: #dbe4e8;
  --bg: #f4f7f8;
  --card: #ffffff;
  --accent: #0b6e8f;
  --accent-soft: #e3f1f6;
  --warn: #b4540a;
  --warn-soft: #fdf0e1;
  --ok: #1d7a4c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

h1 { font-size: 1.7rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.6rem; }
p { margin: 0 0 0.6rem; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.2rem;
  background: var(--ink);
  color: #fff;
}
.brand { font-weight: 600; }
.brand small { font-weight: 400; opacity: 0.7; margin-left: 0.3rem; }
.dot { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: #7fd0e8; margin-right: 0.5rem; }
.top .link, .top .hint { color: #cfe3ea; }

.page { max-width: 720px; margin: 0 auto; padding: 1.2rem 16px 3rem; }
.page.wide { max-width: 1080px; }
.intro { margin-bottom: 1rem; }
.intro p, .hint { color: var(--muted); font-size: 0.92rem; }

.chat, .panel, .list, .thread {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
}
.panel { margin-top: 1rem; }
.panel.narrow { max-width: 360px; margin: 2rem auto; }

.chat-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.8rem; }
.actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 0.4rem; }

.badge { background: var(--accent); color: #fff; border-radius: 999px; padding: 0.15rem 0.7rem; font-size: 0.8rem; }
.badge-light { background: var(--accent-soft); color: var(--accent); }

.messages { min-height: 220px; max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; padding: 0.2rem; }
.empty { color: var(--muted); text-align: center; margin: 3rem 0; }

.bubble { max-width: 80%; padding: 0.5rem 0.75rem; border-radius: 10px; background: var(--accent-soft); align-self: flex-start; }
.bubble p { margin: 0; overflow-wrap: anywhere; }
.bubble.gjest { align-self: flex-end; background: var(--ink); color: #fff; }
.bubble.personale { background: #e6f4ec; }
.bubble.system { align-self: center; background: transparent; border: 1px dashed var(--line); font-size: 0.9rem; }
.meta { display: block; font-size: 0.72rem; opacity: 0.7; margin-bottom: 0.15rem; }

/* I personalinnboksen er det gjesten som står til venstre */
.thread .bubble.gjest { align-self: flex-start; }
.thread .bubble.ai, .thread .bubble.personale { align-self: flex-end; }

.composer, .row { display: flex; gap: 0.5rem; margin-top: 0.8rem; }
.stack { display: flex; flex-direction: column; gap: 0.7rem; }
.stack label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.9rem; }

input {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  color: inherit;
}
input:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn { padding: 0.55rem 1rem; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: #fff; font: inherit; cursor: pointer; }
.btn-outline { background: #fff; color: var(--accent); padding: 0.35rem 0.7rem; font-size: 0.88rem; }
.btn-link { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 0.35rem 0.4rem; font-size: 0.88rem; }
.top .btn-link { color: #cfe3ea; }

.error { color: #b3261e; font-size: 0.9rem; margin-top: 0.5rem; }

.inbox { display: grid; grid-template-columns: 300px 1fr; gap: 1rem; align-items: start; }
.list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.item { border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.6rem; cursor: pointer; }
.item p { margin: 0; font-size: 0.85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.selected { border-color: var(--accent); background: var(--accent-soft); }
.item.venter_personale { border-left: 4px solid var(--warn); background: var(--warn-soft); }
.item.personale { border-left: 4px solid var(--ok); }
.item.lukket { opacity: 0.6; }

@media (max-width: 760px) {
  .inbox { grid-template-columns: 1fr; }
  .composer, .row { flex-wrap: wrap; }
}
