/* DFØ dokumentassistent, in DFØ's own visual profile (profilveileder.dfo.no, checked 5 Oct 2026).
   Colours: primary dark blue #012a4c, medium blue #005b91, bright blue #009fe3; secondary green #00ab84, red #e83f53,
   sea green #008ea6, grey #828282, yellow #f7b715. Type: Source Sans (body) and Source Serif (headings), both free;
   fallbacks Arial and Georgia, as the guide says. Component values (square 18px buttons, 2px blue field borders,
   #f7f7f7 page, 80px white header with a #e6e6e6 rule, dark-blue footer, red focus ring) follow dfo.no's own style sheet. */

@font-face { font-family: "Source Sans 3"; font-weight: 400; font-style: normal; font-display: swap; src: url("/static/fonts/SourceSans3-Regular.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 600; font-style: normal; font-display: swap; src: url("/static/fonts/SourceSans3-Semibold.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 700; font-style: normal; font-display: swap; src: url("/static/fonts/SourceSans3-Bold.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 600; font-style: normal; font-display: swap; src: url("/static/fonts/SourceSerif4-Semibold.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 700; font-style: normal; font-display: swap; src: url("/static/fonts/SourceSerif4-Bold.woff2") format("woff2"); }

:root {
  --dark-blue: #012a4c;
  --mid-blue: #005b91;
  --bright-blue: #009fe3;
  --green: #00ab84;
  --red: #e83f53;
  --sea-green: #008ea6;
  --grey: #828282;
  --yellow: #f7b715;
  --page: #f7f7f7;
  --surface: #ffffff;
  --text: #333333;
  --rule: #e6e6e6;
  --hover-surface: #eaf0f6;
  --disabled-bg: #ededed;
  --disabled-text: #6b6b6b;
  --disabled-border: #bbbbbb;
  --font-sans: "Source Sans 3", "Source Sans Pro", Arial, sans-serif;
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --header-height: 80px;
  --footer-height: 48px;
  --transition: 0.25s;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text); overflow: hidden;
  font-family: var(--font-sans); font-size: 18px; line-height: 1.5;
}
[hidden] { display: none !important; }

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; color: var(--dark-blue); margin: 0; }
a { color: var(--dark-blue); }
a:hover { color: var(--bright-blue); }
button, input, select, textarea { font: inherit; color: inherit; }

/* DFØ's focus ring: 2px red */
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
a:focus-visible, button:focus-visible { outline-offset: -1px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- buttons (dfo.no: square, 18px, 10px 24px, #005b91, hover #009fe3) ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 24px; border: 2px solid var(--mid-blue); border-radius: 0; cursor: pointer;
  background: var(--mid-blue); color: #fff; font-size: 18px; line-height: 1.5; text-decoration: none; white-space: nowrap;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}
.btn:hover:not(:disabled) { background: var(--bright-blue); border-color: var(--bright-blue); color: #fff; }
.btn:disabled { background: var(--disabled-bg); border-color: var(--disabled-border); color: var(--disabled-text); cursor: not-allowed; }
.btn--secondary { background: #fff; color: var(--mid-blue); }
.btn--secondary:hover:not(:disabled) { background: var(--hover-surface); border-color: var(--mid-blue); color: var(--dark-blue); }
.btn--small { padding: 4px 16px; font-size: 16px; }
.btn--aubergine { background: var(--red); border-color: var(--red); } /* DFØ's red button: stop and delete */
.btn--aubergine:hover:not(:disabled) { background: #c92f43; border-color: #c92f43; }

/* ---------- shell: header / (sidebar + main) / footer ---------- */

.app { display: grid; grid-template-rows: var(--header-height) minmax(0, 1fr) var(--footer-height); height: 100vh; }
.body { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 0; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

/* ---------- header ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  height: var(--header-height); padding: 0 32px; background: var(--surface); border-bottom: 2px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 20px; min-width: 0; }
.brand img { display: block; height: 40px; width: auto; }
.product {
  margin: 0; padding-left: 20px; border-left: 2px solid var(--rule);
  font-family: var(--font-serif); font-weight: 600; font-size: 22px; line-height: 28px; color: var(--dark-blue);
  white-space: nowrap;
}
.picker { display: flex; align-items: center; gap: 12px; min-width: 0; }
.picker label { font-size: 16px; color: var(--text); }
select {
  min-width: 240px; max-width: 360px; height: 48px; padding: 0 44px 0 16px;
  border: 2px solid var(--mid-blue); border-radius: 0; background-color: #fff; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5l6 6 6-6' fill='none' stroke='%23005b91' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
select:disabled { background-color: var(--disabled-bg); border-color: var(--disabled-border); color: var(--disabled-text); cursor: not-allowed; }
.topnav { display: flex; align-items: center; gap: 28px; }
.toplink {
  display: inline-block; padding: 6px 0; text-decoration: none; color: var(--dark-blue);
  border-bottom: 3px solid transparent;
}
.toplink:hover { color: var(--bright-blue); }
.toplink[aria-current] { border-bottom-color: var(--bright-blue); }

/* ---------- sidebar ---------- */

.sidebar {
  background: var(--surface); border-right: 2px solid var(--rule);
  display: flex; flex-direction: column; gap: 20px; padding: 24px 16px; min-height: 0;
}
.sidebar > .btn { align-self: stretch; }
.sidebar nav { overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }

.chat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-item { display: flex; align-items: center; border-left: 4px solid transparent; }
.chat-item:hover { background: var(--hover-surface); }
.chat-item.is-open { background: var(--hover-surface); border-left-color: var(--mid-blue); }
.chat-open {
  flex: 1; min-width: 0; text-align: left; background: none; border: 0; border-radius: 0;
  padding: 10px 8px 10px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  font-size: 16px; color: var(--dark-blue);
}
.chat-item.is-open .chat-open { font-weight: 600; }
.chat-delete {
  flex: none; width: 36px; height: 36px; margin-right: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--grey); cursor: pointer; opacity: 0;
  transition: opacity var(--transition), color var(--transition);
}
.chat-item:hover .chat-delete, .chat-item.is-open .chat-delete, .chat-delete:focus-visible { opacity: 1; }
.chat-delete:hover { color: var(--red); }

/* ---------- chat view ---------- */

.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages-wrap { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 32px 32px 16px; }
.new-text { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); box-shadow: 0 4px 16px rgba(1, 42, 76, 0.15); }
.thread, .empty, .composer { max-width: 760px; margin-left: auto; margin-right: auto; }
.thread { display: flex; flex-direction: column; gap: 28px; }
.empty { color: var(--text); margin-top: 16px; }

.msg p { margin: 0 0 12px; }
.msg p:last-child { margin-bottom: 0; }
.msg--user {
  align-self: flex-end; max-width: 80%;
  background: var(--surface); border: 2px solid var(--rule); border-left: 4px solid var(--mid-blue);
  padding: 12px 18px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--dark-blue);
}
.msg--answer { overflow-wrap: anywhere; }
.answer-body ul, .answer-body ol { margin: 0 0 12px; padding-left: 24px; }
.answer-body li { margin: 4px 0; }
.answer-body strong { font-weight: 700; color: var(--dark-blue); }
.answer-body code { font-family: inherit; background: var(--hover-surface); padding: 1px 6px; }
.answer-body a, .sources a { color: var(--dark-blue); text-decoration: underline; text-underline-offset: 2px; }
.answer-body a:hover, .sources a:hover { color: var(--bright-blue); }

.note, .caption, .muted, .help, .elapsed { color: var(--text); font-size: 16px; line-height: 24px; }
.note { margin-top: 8px !important; }
.elapsed { color: var(--disabled-text); margin-left: 6px; }

/* progress trail: finished steps muted with a CSS check mark, the current step with a seconds counter */
.trail { list-style: none; margin: 0 0 12px; padding: 0; font-size: 16px; line-height: 24px; }
.trail-step { position: relative; padding-left: 26px; margin: 2px 0; }
.trail-step.is-done { color: var(--disabled-text); }
.trail-step.is-done::before {
  content: ""; position: absolute; left: 5px; top: 5px; width: 6px; height: 11px;
  border: solid var(--green); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.trail-step.is-current { color: var(--dark-blue); }
.trail-step.is-current::before {
  content: ""; position: absolute; left: 3px; top: 7px; width: 10px; height: 10px;
  border: 2px solid var(--mid-blue); border-radius: 50%;
}
.trail-summary { margin: 0 0 12px; font-size: 16px; line-height: 24px; color: var(--disabled-text); }
.trail-summary summary { cursor: pointer; width: max-content; }
.trail-summary summary:hover { color: var(--dark-blue); }
.trail-summary .trail { margin: 6px 0 0; }

/* placeholder lines until the first word; static when the user prefers reduced motion */
.skeleton { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.skeleton-line { display: block; height: 14px; background: var(--rule); animation: skeleton-pulse 1.6s ease-in-out infinite; }
.skeleton-line:nth-child(1) { width: 92%; }
.skeleton-line:nth-child(2) { width: 84%; animation-delay: 0.2s; }
.skeleton-line:nth-child(3) { width: 58%; animation-delay: 0.4s; }
@keyframes skeleton-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .skeleton-line { animation: none; } }

.found { margin-top: 20px; padding: 12px 20px; border-left: 4px solid var(--rule); font-size: 16px; line-height: 24px; }
.found-title { margin: 0 0 4px !important; color: var(--disabled-text); }
.found ul { margin: 0; padding-left: 20px; }
.found a { color: var(--dark-blue); }

.eyebrow { font: 600 18px/24px var(--font-serif); color: var(--dark-blue); margin: 0 0 8px; }
.sources { margin-top: 20px; padding: 16px 20px; background: var(--surface); border: 2px solid var(--rule); border-left: 4px solid var(--bright-blue); }
.sources ol { margin: 0; padding-left: 22px; font-size: 16px; line-height: 24px; }
.sources li { margin: 4px 0; }
.version { color: var(--text); }

.shot { margin: 20px 0 0; }
.shot-open { display: block; padding: 0; border: 2px solid var(--rule); border-radius: 0; background: #fff; cursor: zoom-in; max-width: 100%; overflow: hidden; }
.shot-open:hover { border-color: var(--bright-blue); }
.shot-open img { display: block; max-width: 100%; max-height: 352px; height: auto; }
.shot figcaption { margin-top: 8px; }

.error {
  margin-top: 12px; padding: 14px 18px; background: var(--surface); border: 2px solid var(--rule); border-left: 4px solid var(--red);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.error p { margin: 0; }
.answer-body:empty ~ .error { margin-top: 0; }
.messages > .error { max-width: 760px; margin: 16px auto; }

/* composer */
.composer {
  width: 100%; padding: 12px 32px 20px; max-width: 824px;
  display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: end;
}
.composer textarea {
  resize: none; min-height: 52px; max-height: 240px; padding: 12px 16px;
  border: 2px solid var(--mid-blue); border-radius: 0; background: #fff; line-height: 1.5;
}
.composer textarea:focus { border-color: var(--dark-blue); }
.composer textarea:disabled { background: var(--disabled-bg); border-color: var(--disabled-border); color: var(--disabled-text); }
.composer .btn { min-height: 52px; }
.composer-hint { grid-column: 1 / -1; margin: 0; color: var(--grey); font-size: 14px; line-height: 20px; }

/* ---------- setup view ---------- */

.setup-view { flex: 1; overflow-y: auto; padding: 32px; }
.setup { display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 40px; max-width: 1152px; margin: 0 auto; }
.setup-title { font: 600 28px/36px var(--font-serif); color: var(--dark-blue); margin: 0 0 16px; }
.setup-title:focus { outline: none; }
.setup-list { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.assistant-list { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 2px; }
.assistant-item {
  width: 100%; text-align: left; background: var(--surface); border: 0; border-left: 4px solid transparent; cursor: pointer;
  padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; color: var(--dark-blue);
  transition: background-color var(--transition);
}
.assistant-item:hover { background: var(--hover-surface); }
.assistant-item.is-open { background: var(--hover-surface); border-left-color: var(--mid-blue); }
.assistant-name { font-size: 18px; font-weight: 600; }
.assistant-folder { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }

.assistant-form { background: var(--surface); border: 2px solid var(--rule); padding: 28px 32px; }
.form-title { font: 600 24px/32px var(--font-serif); color: var(--dark-blue); margin: 0; }
.assistant-form .muted { margin: 4px 0 24px; min-height: 24px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.field label { font-weight: 600; color: var(--dark-blue); }
.field input, .field textarea {
  border: 2px solid var(--mid-blue); border-radius: 0; background: #fff; padding: 12px 16px; line-height: 1.5;
}
.field input:focus, .field textarea:focus { border-color: var(--dark-blue); }
.field textarea { min-height: 384px; resize: vertical; }
.help { margin: 0; }
.form-error { margin: 0 0 16px; padding: 12px 16px; background: #fff; border: 2px solid var(--rule); border-left: 4px solid var(--red); }
.form-saved { margin: 0 0 16px; color: var(--text); min-height: 0; }
.form-saved:empty { display: none; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- dialogs ---------- */

dialog { border: 0; border-top: 4px solid var(--mid-blue); border-radius: 0; padding: 24px; background: #fff; color: var(--text); box-shadow: 0 8px 32px rgba(1, 42, 76, 0.25); }
dialog::backdrop { background: rgba(1, 42, 76, 0.6); }
.confirm-dialog { max-width: 448px; }
.confirm-dialog p { margin: 0 0 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; }
.image-dialog { max-width: 92vw; padding: 16px; }
.image-dialog img { display: block; max-width: calc(92vw - 32px); max-height: 78vh; margin: 0 auto; }
.dialog-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; }
.dialog-row .caption { margin: 0; }

/* ---------- footer (dfo.no: dark blue band, white text, #009fe3 on hover) ---------- */

.footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 32px; background: var(--dark-blue); color: #fff; font-size: 14px; line-height: 20px;
}
/* baseline, not center: "Drevet av" then ends on the same line as the bottom of the logo's letters (the logo image has no empty margin) */
.powered { display: flex; align-items: baseline; gap: 10px; margin: 0; }
.powered img { display: block; height: 18px; width: auto; }

/* ---------- narrower laptops ---------- */

@media (max-width: 1100px) {
  .body { grid-template-columns: 240px minmax(0, 1fr); }
  .topbar { padding: 0 20px; gap: 16px; }
  .brand { gap: 14px; }
  .product { padding-left: 14px; font-size: 19px; }
  select { min-width: 150px; max-width: 240px; }
  .picker label {  /* visually hidden, still the select's name for screen readers */
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .messages { padding: 24px 20px 12px; }
  .composer { padding: 12px 20px 16px; }
  .setup-view { padding: 24px 20px; }
  .setup { grid-template-columns: 208px minmax(0, 1fr); gap: 24px; }
  .assistant-form { padding: 20px; }
  .footer { padding: 0 20px; }
}
@media (max-width: 900px) {
  .product { font-size: 17px; }
  .toplink { font-size: 16px; }
}
