/* iLab Assistant på nett. Fargene er sintef.energy sine (landing, assets/enkel.css): SINTEF-blå, logoblå, iLab-grønn
   og produktfargene fra logoene. Produktfargene brukes bare til kanter og markeringer, aldri til tekst. */
:root {
  --bg: #ffffff; --panel: #f2f6f9; --raised: #ffffff; --fg: #10222f; --dim: #4a6072; --line: #d5e0e9;
  --blue: #003c65; --brand: #4b96d1; --link: #003c65; --ilab: #14b978; --ilab-soft: rgba(20, 185, 120, .12);
  --btn-bg: #003c65; --btn-fg: #ffffff; --user: #e7f0f7; --code: #f2f6f9; --warn: #b7791f;
  --product: #77c043;
  --shadow: 0 1px 2px rgba(16, 34, 47, .06), 0 4px 16px rgba(16, 34, 47, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #001a2c; --panel: #032740; --raised: #04304e; --fg: #e8f0f6; --dim: #a6bccc; --line: #1b4463;
    --link: #64cbe6; --btn-bg: #4b96d1; --btn-fg: #001a2c; --user: #0b3a5c; --code: #021f33; --warn: #f0b75a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column; background: var(--bg); color: var(--fg);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Calibri, Arial, sans-serif;
}
button { font: inherit; cursor: pointer; color: inherit; }
a { color: var(--link); }
img { display: block; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------------------------------------------------------------- hode */
.top {
  display: flex; align-items: center; gap: 14px; padding: 10px 20px; flex-wrap: wrap;
  background: var(--bg); border-bottom: 1px solid var(--line); position: relative;
}
.top::after {  /* tynn stripe i produktfargen */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--ilab), var(--product));
}
.se img { height: 22px; width: auto; }
.divider { width: 1px; height: 28px; background: var(--line); }
.app { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); margin-right: auto; }
.app-text { display: flex; flex-direction: column; line-height: 1.15; }
.app-text strong { font-size: 17px; }
.app-text small { color: var(--dim); font-size: 12.5px; }
.products { display: flex; gap: 4px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.product {
  display: flex; align-items: center; gap: 7px; border: 0; background: transparent; padding: 5px 12px 5px 8px;
  border-radius: 7px; font-weight: 600; font-size: 14px; color: var(--dim);
}
.product img { width: 20px; height: 20px; }
.product:hover { color: var(--fg); }
.product[aria-pressed="true"] { background: var(--raised); color: var(--fg); box-shadow: var(--shadow), inset 0 -2px 0 var(--c); }
.lang {
  border: 1px solid var(--line); background: var(--bg); color: var(--dim); border-radius: 8px;
  padding: 4px 9px; font-size: 13px; font-weight: 700; letter-spacing: .04em;
}
.lang:hover { color: var(--fg); border-color: var(--brand); }
.user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.avatar-user {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
@media (prefers-color-scheme: dark) { .avatar-user { background: var(--brand); color: #001a2c; } }
.logout { color: var(--dim); }

body.embed .top { padding: 6px 12px; gap: 10px; }
body.embed .se, body.embed .divider, body.embed .app-text small, body.embed .logout { display: none; }

/* ---------------------------------------------------------------- innlogging */
main { flex: 1; min-height: 0; display: flex; justify-content: center; }
.login { margin: auto; text-align: center; max-width: 760px; padding: 32px 20px; }
.login-logo img { margin: 0 auto; }
.login h1 { margin: 14px 0 6px; font-size: 30px; letter-spacing: -.01em; }
.lead { color: var(--dim); font-size: 17px; margin: 0 0 18px; }
.primary {
  background: var(--btn-bg); color: var(--btn-fg); border: 0; border-radius: 10px; padding: 11px 22px; font-weight: 600;
}
.primary:hover { filter: brightness(1.12); }
.primary:disabled { opacity: .45; cursor: default; filter: none; }
.trust.compact { margin-top: 32px; text-align: left; }

/* ---------------------------------------------------------------- chat */
.chat { flex: 1; min-height: 0; width: 100%; max-width: 900px; display: flex; flex-direction: column; padding: 0 20px; }
.log { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 2px 12px; scroll-behavior: smooth; }

.welcome { padding: 8px 0 16px; }
.hero { display: flex; gap: 18px; align-items: center; }
.hero .product-logo img { width: 64px; height: 64px; }
.eyebrow { margin: 0; color: var(--ilab); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
.hero h1 { margin: 2px 0 4px; font-size: 28px; letter-spacing: -.01em; }
.hero .lead { margin: 0; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.fact {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--dim);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; text-decoration: none;
}
.fact.strong { color: var(--fg); font-weight: 600; border-color: color-mix(in srgb, var(--product) 55%, var(--line)); }
.fact.ext:hover { color: var(--fg); border-color: var(--brand); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.ok { background: var(--ilab); box-shadow: 0 0 0 3px var(--ilab-soft); }
.dot.warn { background: var(--warn); }
h2.section { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin: 26px 0 10px; }
.examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.example {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left;
  background: var(--raised); border: 1px solid var(--line); border-left: 3px solid var(--product);
  border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s;
}
.example:hover { transform: translateY(-1px); border-color: var(--brand); border-left-color: var(--product); }
.example .arrow { color: var(--dim); }

.trust { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 26px; }
.trust-item {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
}
.trust-item svg { color: var(--ilab); flex: none; }
.trust-item picture { flex: none; }
.trust-item strong { display: block; font-size: 14.5px; }
.trust-item span { display: block; color: var(--dim); font-size: 13.5px; line-height: 1.45; }

.about { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); }
.about summary { cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: 14.5px; }
.about-body { padding: 0 16px 6px; font-size: 14.5px; color: var(--dim); }
.about-body strong { color: var(--fg); }
.about-body ul { padding-left: 18px; }
.about-body li { margin: 4px 0; }
.links { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- meldinger */
.msg { margin: 16px 0; }
.msg.user .body {
  margin-left: auto; width: fit-content; max-width: 82%; background: var(--user);
  padding: 9px 15px; border-radius: 16px 16px 4px 16px; white-space: pre-wrap;
}
.msg.assistant {
  background: var(--raised); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px 10px;
  box-shadow: var(--shadow);
}
.meta { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.meta .avatar img { width: 26px; height: 26px; }
.spacer { flex: 1; }
.chip {
  font-size: 12px; color: var(--ilab); background: var(--ilab-soft); border-radius: 999px; padding: 2px 9px;
  font-weight: 600; cursor: help;
}
.copy {
  font-size: 12px; color: var(--dim); background: transparent; border: 1px solid var(--line);
  border-radius: 7px; padding: 2px 9px;
}
.copy:hover { color: var(--fg); border-color: var(--brand); }

.work { margin: 10px 0 4px; border-left: 2px solid var(--ilab); padding: 2px 0 2px 12px; }
.work summary { cursor: pointer; color: var(--dim); font-size: 13px; }
.steps { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; }
.step { display: flex; align-items: center; gap: 8px; padding: 2px 0; color: var(--dim); min-width: 0; }
.step .dot { background: var(--ilab); }
.step.running .dot { animation: pulse 1s ease-in-out infinite; }
.step.failed .dot { background: var(--warn); }
.step .what { color: var(--fg); white-space: nowrap; }
.step .arg {
  font-size: 12px; background: var(--code); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.step .ms { margin-left: auto; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pages { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.page {
  display: inline-flex; align-items: baseline; gap: 6px; font-size: 12.5px; text-decoration: none; color: var(--fg);
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 3px 9px; max-width: 100%;
}
.page .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page small { color: var(--dim); }
.page:hover { border-color: var(--brand); }

.body { overflow-wrap: anywhere; }
.body.streaming { white-space: pre-wrap; }
.body > :first-child { margin-top: 8px; }
.body > :last-child { margin-bottom: 4px; }
.body h1, .body h2, .body h3 { font-size: 1.05em; margin: 1.1em 0 .4em; }
.body pre {
  position: relative; background: var(--code); border: 1px solid var(--line); padding: 12px 14px; border-radius: 10px;
  overflow-x: auto; font-size: 13.5px; line-height: 1.5;
}
.body pre .copy { position: absolute; top: 8px; right: 8px; background: var(--raised); }
.body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.body :not(pre) > code { background: var(--code); border: 1px solid var(--line); padding: 0 5px; border-radius: 5px; }
.body table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 14px; margin: .6em 0; }
.body th, .body td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.body th { background: var(--panel); }
.body a { color: var(--link); }
.body blockquote { margin: .6em 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--dim); }
.typing { display: inline-flex; gap: 4px; padding: 8px 0 4px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ilab); animation: pulse 1.2s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
.stats { margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line); color: var(--dim); font-size: 12px; }
.stats:empty { display: none; }
.error { color: #c0392b; }
@media (prefers-color-scheme: dark) { .error { color: #ff8a80; } }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .typing i, .step.running .dot { animation: none; } .log { scroll-behavior: auto; } }

/* ---------------------------------------------------------------- skrivefelt */
.composer {
  display: flex; gap: 8px; align-items: flex-end; padding: 8px; margin-top: 4px;
  background: var(--raised); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.composer:focus-within { border-color: var(--ilab); }
.composer textarea {
  flex: 1; resize: none; font: inherit; color: var(--fg); background: transparent; border: 0;
  padding: 7px 8px; max-height: 200px; outline: none;
}
.send { padding: 9px 12px; border-radius: 10px; display: grid; place-items: center; }
.note { display: flex; justify-content: space-between; gap: 12px; color: var(--dim); font-size: 12.5px; margin: 6px 4px 12px; }
.link { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; font-size: inherit; }

@media (max-width: 640px) {
  .top { padding: 8px 12px; gap: 10px; }
  .se, .divider, .app-text small { display: none; }
  .chat { padding: 0 12px; }
  .hero { align-items: flex-start; }
  .hero .product-logo img { width: 44px; height: 44px; }
  .hero h1 { font-size: 23px; }
  .msg.user .body { max-width: 92%; }
}
