/* Planklar chat: an app layout like ChatGPT and Claude (sidebar, thread, composer at the bottom) in Planklar's design:
   paper and graphite ink, one survey-orange signal colour, thin precise lines, mono for numbers and sources. The tokens
   are the landing page's (static/landing/landing.css). */
@font-face { font-family: "Schibsted Grotesk"; font-weight: 400 900; font-display: swap; src: url("../fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Schibsted Grotesk"; font-weight: 400 900; font-display: swap; src: url("../fonts/schibsted-grotesk-latin-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --paper: #f4f2ec;
  --paper-2: #ebe8df;
  --sheet: #fbfaf6;
  --ink: #121417;
  --ink-2: #3a3f45;
  --muted: #5f656b;
  --line: #d8d4c9;
  --line-2: #bdb8ab;
  --signal: #ff5b22;
  --signal-ink: #b83a0a;
  --signal-wash: #ffe7dc;
  --night: #101316;
  --on-night: #f4f2ec;
  --ok: #276e44;
  --ok-wash: #e3f0e7;
  --warn: #8a5a00;
  --warn-wash: #f7ecd2;
  --bad: #a8262e;
  --bad-wash: #f6e0df;
  --na: #5f656b;
  --field: #fff;
  --placeholder: #6b7075;
  --on-signal: #121417;
  --code-btn: #1a1e22;
  --code-line: #3a4046;
  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --side-w: 288px;
  --col: 48rem;
  --bar-h: 56px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* dark mode follows the system, as ChatGPT and Claude do: the same roles, darker paper, lighter ink */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #141619;
    --paper-2: #1c1f23;
    --sheet: #1f2328;
    --field: #24292e;
    --ink: #ecebe6;
    --ink-2: #c5c7c9;
    --muted: #a0a5ab;
    --line: #30353b;
    --line-2: #474e56;
    --signal: #ff6a33;
    --signal-ink: #ff9b70;
    --signal-wash: #3b2318;
    --night: #0c0e10;
    --on-night: #ecebe6;
    --ok: #74c796;
    --ok-wash: #15281d;
    --warn: #e3b552;
    --warn-wash: #2d2512;
    --bad: #f2838a;
    --bad-wash: #301a1c;
    --na: #a0a5ab;
    --placeholder: #8d9399;
    --code-btn: #1d2125;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow: hidden;
}
[hidden] { display: none !important; }
svg { display: block; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
p { margin: 0; }
button { font: inherit; color: inherit; }
::selection { background: var(--signal); color: var(--ink); }
:focus-visible { outline: 2px solid var(--signal-ink); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 6px; text-decoration: none; }
.skip:focus { top: 12px; }
.file { display: none; }
.noscript { position: fixed; inset: auto 16px 16px; z-index: 90; padding: 12px 14px; background: var(--ink); color: var(--paper); border-radius: 8px; }

/* ---------- shared pieces ---------- */
.label { display: inline-flex; align-items: center; gap: 8px; margin: 0; font: 500 11px/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.label::before { content: ""; width: 8px; height: 8px; background: var(--signal); flex: none; }
.btn {
  --b: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 8px; border: 1.5px solid var(--b); font: 600 15px/1.2 var(--sans); color: var(--ink); background: transparent;
  text-decoration: none; cursor: pointer; text-align: center; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn--signal { --b: var(--signal); background: var(--signal); color: var(--on-signal); }
.btn--signal:hover { --b: var(--ink); background: var(--ink); color: var(--paper); }
.btn--ink { background: var(--ink); color: var(--paper); }
.btn--ink:hover { --b: var(--signal); background: var(--signal); color: var(--ink); }
.btn--bad { --b: var(--bad); background: var(--bad); color: #fff; }
.btn--bad:hover { --b: var(--ink); background: var(--ink); }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 7px; }
.btn .ico svg { width: 16px; height: 16px; }
.arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14.5px; text-decoration: none; border-bottom: 1.5px solid currentColor; padding-bottom: 1px; }
.arrow::after { content: "→"; transition: transform 0.2s var(--ease); }
.arrow:hover::after { transform: translateX(3px); }
.linkbtn { padding: 0; border: 0; background: none; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.iconbtn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: 9px;
  background: transparent; color: var(--ink-2); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.iconbtn:hover { background: var(--paper-2); color: var(--ink); }
.iconbtn svg, .ico svg { width: 20px; height: 20px; }
.ico { display: inline-grid; place-items: center; flex: none; }
.st { display: inline-flex; align-items: center; gap: 6px; font: 500 11.5px/1 var(--mono); letter-spacing: 0.02em; padding: 5px 8px 5px 7px; border-radius: 4px; white-space: nowrap; border: 1px solid transparent; }
.st::before { content: ""; width: 8px; height: 8px; flex: none; border-radius: 2px; }
.st--ok { background: var(--ok-wash); color: var(--ok); }
.st--ok::before { background: var(--ok); }
.st--warn { background: var(--warn-wash); color: var(--warn); }
.st--warn::before { background: repeating-linear-gradient(45deg, var(--warn) 0 2px, transparent 2px 4px); outline: 1px solid var(--warn); }
.st--bad { background: var(--bad-wash); color: var(--bad); }
.st--bad::before { background: var(--bad); border-radius: 50%; }
.st--na { background: transparent; color: var(--na); border-color: var(--line-2); border-style: dashed; }
.st--na::before { border: 1.5px dashed var(--na); }
.st--info { background: var(--paper-2); color: var(--ink-2); }
.st--info::before { background: var(--ink-2); }

/* ---------- app layout ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100vh; height: 100dvh; transition: grid-template-columns 0.25s var(--ease); }
.app.is-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app.is-collapsed .side { visibility: hidden; }

.side {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden auto; overscroll-behavior: contain;
  background: var(--paper-2); border-right: 1px solid var(--line);
}
.side__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 6px 16px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 700; font-size: 19px; letter-spacing: -0.03em; }
.brand svg { width: 28px; height: 28px; }
.side__new {
  display: flex; align-items: center; gap: 10px; margin: 6px 12px 10px; padding: 10px 12px; border: 1.5px solid var(--ink); border-radius: 10px;
  background: var(--sheet); font-weight: 600; font-size: 15px; text-decoration: none; transition: background 0.15s, color 0.15s;
}
.side__new svg { width: 18px; height: 18px; }
.side__new:hover { background: var(--ink); color: var(--paper); }
.convs { flex: 1 0 auto; min-height: 120px; padding: 4px 8px 12px; }
.convs__h { margin: 14px 8px 4px; font: 500 10.5px/1.3 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.convs__list { list-style: none; margin: 0; padding: 0; }
.convs__empty { margin: 10px 8px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.conv { position: relative; display: flex; align-items: center; border-radius: 8px; }
.conv:hover, .conv:focus-within { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.conv__a { flex: 1; min-width: 0; display: grid; gap: 1px; padding: 8px 6px 8px 10px; border-radius: 8px; text-decoration: none; font-size: 14.5px; line-height: 1.35; }
.conv.is-current { background: var(--sheet); box-shadow: inset 3px 0 0 var(--signal); }
.conv.is-current .conv__a { font-weight: 600; }
.conv__run { display: grid; place-items: center; width: 34px; height: 34px; margin-right: 2px; flex: none; }
.conv.is-running .conv__t { color: var(--ink); }
.conv__t, .conv__s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv__s { font: 400 11.5px/1.35 var(--mono); color: var(--muted); }
.conv__del { width: 34px; height: 34px; margin-right: 2px; color: var(--muted); opacity: 0; }
.conv__del svg { width: 17px; height: 17px; }
.conv:hover .conv__del, .conv:focus-within .conv__del, .conv__del:focus-visible { opacity: 1; }
.conv__del:hover { color: var(--bad); background: var(--bad-wash); }
@media (hover: none) { .conv__del { opacity: 1; } }

.side__foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: grid; gap: 12px; }
.plan { display: grid; gap: 8px; padding: 12px; background: var(--sheet); border: 1px solid var(--line-2); border-radius: 10px; }
.plan__who { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.plan__text { font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.plan__line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.plan__tag { font: 500 11px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; padding: 5px 7px; border-radius: 4px; background: var(--paper-2); color: var(--ink-2); }
.plan__tag--pro, .plan__tag--kode, .plan__tag--superbruker { background: var(--ink); color: var(--paper); }
.plan__tag--eiendomspass { background: var(--signal-wash); color: var(--signal-ink); }
.plan__left { font: 400 12.5px/1.3 var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.plan__meter { height: 6px; margin: 8px 0 4px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.plan__meter span { display: block; height: 100%; background: var(--ink-2); border-radius: 3px; }
.plan__meter.is-low span { background: var(--signal); }
.plan__cta { justify-self: start; }
.side__links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.side__links a, .side__links .linkbtn { color: var(--ink-2); font-weight: 500; }
.side__links form { display: inline; }
.bunntekst { font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.bunntekst p { margin: 0 0 4px; }

.scrim { position: fixed; inset: 0; z-index: 59; background: rgba(16, 19, 22, 0.42); }

.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.bar { flex: none; display: flex; align-items: center; gap: 8px; height: var(--bar-h); padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--paper); }
.bar__end { position: relative; margin-left: auto; display: flex; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: min(100%, 460px); min-height: 40px; padding: 4px 10px 4px 10px;
  border: 1px solid var(--line-2); border-radius: 999px; background: var(--sheet); cursor: pointer; text-align: left; transition: border-color 0.15s, background 0.15s;
}
.chip:hover { border-color: var(--ink); }
.chip.is-empty { border-style: dashed; color: var(--ink-2); }
.chip__ico { width: 18px; height: 18px; flex: none; color: var(--signal-ink); }
.chip__text { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.chip__name { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip__sub { flex: none; font: 400 11.5px/1 var(--mono); color: var(--muted); }
.chip__caret { width: 16px; height: 16px; flex: none; color: var(--muted); }

.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 250px; padding: 6px; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 10px; box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.45); }
.menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 7px; background: none; font-size: 14.5px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; }
.menu__item svg { width: 18px; height: 18px; flex: none; }
.menu__item:hover, .menu__item:focus-visible { background: var(--paper-2); outline-offset: -2px; }
.menu__item--bad { color: var(--bad); }

/* ---------- thread ---------- */
/* no CSS scroll-behavior here: chat.js follows the answer with instant jumps and scrolls smoothly only on request */
.scroll { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.thread { width: min(var(--col), 100% - 32px); margin: 0 auto; padding: 24px 0 32px; display: flex; flex-direction: column; gap: 26px; }
.thread:empty { padding: 0; }
.thread__load { color: var(--muted); font-size: 15px; }
.tobottom {
  position: sticky; bottom: 12px; left: 50%; display: grid; place-items: center; width: 38px; height: 38px; margin: -50px auto 12px; transform: translateX(0);
  border: 1px solid var(--line-2); border-radius: 50%; background: var(--sheet); color: var(--ink); cursor: pointer; box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.5);
}
.tobottom svg { width: 18px; height: 18px; }
.tobottom:hover { border-color: var(--ink); }

.msg { min-width: 0; }
.msg--me { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.bubble {
  max-width: min(85%, 38rem); padding: 10px 15px; background: var(--sheet); border: 1px solid var(--line-2); border-radius: 18px 18px 4px 18px;
  font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg__atts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 85%; }
.msg--pk { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 14px; align-items: start; }
.avatar { display: block; width: 30px; height: 30px; margin-top: 1px; }
.avatar svg { width: 30px; height: 30px; }
.msg__body { min-width: 0; display: grid; gap: 12px; }
.msg__body > div:empty { display: none; }
.msg__flow { min-width: 0; display: grid; gap: 12px; }
.msg__edit { width: 30px; height: 30px; margin: -6px 0 -14px; color: var(--muted); opacity: 0; }
.msg--me:hover .msg__edit, .msg__edit:focus-visible { opacity: 1; }
@media (hover: none) { .msg__edit { opacity: 1; } }
.msg__edit svg { width: 17px; height: 17px; }
.msg__unsent { font: 500 11.5px/1.3 var(--mono); color: var(--bad); }
.edit { width: min(85%, 38rem); display: grid; gap: 8px; padding: 10px; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 14px; }
.edit__in { width: 100%; min-height: 64px; padding: 6px 8px; border: 0; outline: 0; resize: vertical; background: transparent; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.45; }
.edit__note { font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.edit__row { display: flex; justify-content: flex-end; gap: 8px; }
.msg__cards, .msg__files, .msg__notes { display: grid; gap: 10px; }
.msg__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: -4px 0 0 -8px; }
.act { width: 34px; height: 34px; color: var(--muted); }
.act svg { width: 18px; height: 18px; }
.act[aria-pressed="true"] { color: var(--ink); background: var(--paper-2); }
.act.is-done { color: var(--ok); }
.act--retry, .act--regen { width: auto; height: 34px; margin-left: 6px; color: var(--ink); }
.act--regen { border-color: var(--line-2); font-weight: 500; }

.typing { display: inline-flex; gap: 5px; align-items: center; height: 26px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-2); animation: bob 1.1s var(--ease) infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bob { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }

/* the answer's Markdown */
.md { font-size: 16px; line-height: 1.65; overflow-wrap: anywhere; min-width: 0; }
.md :where(p) { margin: 0; }
.md h3, .md h4, .md h5, .md h6 { margin: 1.2em 0 0; line-height: 1.25; letter-spacing: -0.012em; }
.md > h3:first-child, .md > h4:first-child, .md > h5:first-child, .md > h6:first-child { margin-top: 0; }
.md h3 { font-size: 21px; font-weight: 700; }
.md h4 { font-size: 18px; font-weight: 650; }
.md h5, .md h6 { font-size: 16px; font-weight: 650; }
.md :where(ul, ol) { margin: 0; padding-left: 1.45em; }
/* space between blocks (paragraphs, lists, tables): after the margins above, so it wins */
.md > * + *, .md li > * + p { margin-top: 0.8em; }
.md li + li { margin-top: 0.3em; }
.md li > ul, .md li > ol { margin-top: 0.3em; }
.md li::marker { color: var(--signal-ink); }
.md strong { font-weight: 650; }
.md a { color: var(--ink); text-decoration-color: var(--signal); text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 500; }
.md a:hover { color: var(--signal-ink); }
.md code { font: 400 0.88em/1.4 var(--mono); padding: 0.12em 0.38em; border-radius: 4px; background: var(--paper-2); border: 1px solid var(--line); overflow-wrap: anywhere; }
.md :where(pre) { margin: 0; }
.md pre { position: relative; padding: 40px 16px 16px; border-radius: 10px; background: var(--night); color: var(--on-night); overflow-x: auto; }
.md pre code { padding: 0; border: 0; background: none; color: inherit; font-size: 13.5px; line-height: 1.6; white-space: pre; overflow-wrap: normal; }
.copy-code { position: absolute; top: 6px; right: 6px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--code-line); border-radius: 6px; background: var(--code-btn); color: var(--on-night); font: 500 12px/1 var(--mono); cursor: pointer; }
.copy-code svg { width: 14px; height: 14px; }
.copy-code:hover { border-color: var(--on-night); }
.md :where(blockquote) { margin: 0; }
.md blockquote { padding: 2px 0 2px 14px; border-left: 3px solid var(--signal); color: var(--ink-2); }
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 1.2em 0; }
.md del { color: var(--muted); }
.md-table { max-width: 100%; overflow-x: auto; border: 1px solid var(--line-2); border-radius: 8px; background: var(--sheet); }
.md-table table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.45; }
.md-table th, .md-table td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.md-table tr:last-child td { border-bottom: 0; }
.md-table th { font: 500 11px/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); background: var(--paper); white-space: nowrap; }
.md-table td { font-variant-numeric: tabular-nums; }
.md-table .al-r { text-align: right; }
.md-table .al-c { text-align: center; }
.md.is-live > p:last-child::after, .md.is-live > ul:last-child > li:last-child::after, .md.is-live > ol:last-child > li:last-child::after {
  content: ""; display: inline-block; width: 0.5em; height: 1.05em; margin-left: 3px; vertical-align: -0.16em; background: var(--signal); animation: blink 1s steps(2, start) infinite;
}

/* tool steps */
.tools { border: 1px solid var(--line-2); border-radius: 10px; background: var(--sheet); max-width: 100%; }
.tools__sum { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; list-style: none; font: 400 13px/1.4 var(--mono); color: var(--ink-2); border-radius: 10px; }
.tools__sum::-webkit-details-marker { display: none; }
.tools__sum::after { content: ""; width: 7px; height: 7px; margin-left: auto; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.2s; }
.tools[open] .tools__sum::after { transform: rotate(45deg); }
.tools__txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tools__spin { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 1.5px solid var(--ok); background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6.2 5 8l4-4.2'/%3E%3C/svg%3E") center / 10px no-repeat; }
.tools.is-run .tools__spin { background: none; border-color: var(--signal); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.tools.has-feil .tools__spin { border-color: var(--bad); background: var(--bad) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 3v3.6M6 8.8v.2'/%3E%3C/svg%3E") center / 10px no-repeat; }
.tools__list { list-style: none; margin: 0; padding: 2px 12px 8px; border-top: 1px dashed var(--line-2); }
.tool, .tools__list li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 6px 0; font-size: 14px; line-height: 1.4; color: var(--ink-2); }
.tools__list li + li { border-top: 1px dashed var(--line); }
.tool__ico { display: grid; place-items: center; width: 16px; height: 16px; }
.tool__ico svg { width: 16px; height: 16px; }
.tool__lbl { overflow-wrap: anywhere; }
.tool__name { grid-column: 2; grid-row: 2; font: 400 11.5px/1.3 var(--mono); color: var(--muted); }
.tool__st { font: 500 10.5px/1 var(--mono); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.spin { display: block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--signal); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.tool--ferdig .tool__ico { color: var(--ok); }
.tool--ferdig .tool__st { color: var(--ok); }
.tool--feil .tool__ico, .tool--feil .tool__st { color: var(--bad); }
.tool--start { color: var(--ink); }
.tool--start .tool__st { color: var(--signal-ink); }

/* the property card */
.pcard { background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 10px; overflow: hidden; }
.pcard__head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line-2); }
.pcard__title { margin: 8px 0 0; font-size: 19px; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.pcard__facts { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line-2); }
.pcard__facts > div { min-width: 0; padding: 9px 12px 10px 16px; border-left: 1px solid var(--line-2); }
.pcard__facts > div:first-child { border-left: 0; }
.pcard__facts dt { font: 400 10px/1.3 var(--mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.pcard__facts dd { margin: 3px 0 0; font: 500 14px/1.3 var(--mono); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pcard__hind { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-2); font-size: 14px; line-height: 1.4; }
.pcard__hind .st { justify-self: start; }
.pcard__lights { list-style: none; margin: 0; padding: 10px 16px; display: grid; gap: 6px; border-bottom: 1px solid var(--line-2); }
.pcard__lights li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 2px 10px; align-items: center; font-size: 14px; line-height: 1.35; }
.pcard__lights .st { justify-self: start; }
.pcard__lights small { grid-column: 2; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.pcard__sum { padding: 10px 16px; border-bottom: 1px solid var(--line-2); font-size: 14.5px; line-height: 1.5; }
.pcard__sum ul { margin: 4px 0 0; padding-left: 1.2em; }
.pcard__k { font: 500 10.5px/1.3 var(--mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.pcard__pts { margin: 0; padding: 10px 16px; display: grid; gap: 6px; border-bottom: 1px solid var(--line-2); }
.pcard__pts dt { font-size: 12.5px; color: var(--muted); }
.pcard__pts dd { margin: 1px 0 0; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.pcard__locked { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font: 500 12.5px/1.4 var(--mono); color: var(--ink-2); border-bottom: 1px solid var(--line-2); }
.pcard__locked .ico svg { width: 15px; height: 15px; }
.pcard__cta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; background: var(--paper); border-bottom: 1px solid var(--line-2); }
.pcard__note { padding: 9px 16px 11px; font: 400 11px/1.5 var(--mono); color: var(--muted); }

/* files from the answer */
.fcard { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 10px 10px 12px; background: var(--field); border: 1px solid var(--line-2); border-radius: 10px; }
.fcard__ico { width: 44px; height: 44px; border-radius: 8px; background: var(--paper-2); color: var(--ink); }
.fcard__ico svg { width: 22px; height: 22px; }
.fcard--pdf .fcard__ico { background: var(--bad-wash); color: var(--bad); }
.fcard--dxf .fcard__ico, .fcard--ifc .fcard__ico { background: var(--signal-wash); color: var(--signal-ink); }
.fcard--image .fcard__ico { background: var(--ok-wash); color: var(--ok); }
.fcard__txt { min-width: 0; }
.fcard__name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard__meta { font: 400 12px/1.4 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.fcard__acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.fcard__thumb { grid-column: 1 / -1; display: grid; place-items: center; overflow: hidden; border-radius: 8px; background: var(--paper-2); border: 1px solid var(--line); }
.fcard__thumb img { display: block; max-width: 100%; max-height: 240px; width: auto; height: auto; object-fit: contain; background: #fff; }
.fcard__thumb:hover { border-color: var(--ink); }
.fcard__na { font: 400 12px var(--mono); color: var(--muted); }

/* paywall, errors, notes */
.paycard { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 14px 16px; border: 1.5px solid var(--ink); border-radius: 10px; background: var(--signal-wash); }
.paycard__ico { width: 32px; height: 32px; border-radius: 50%; background: var(--sheet); color: var(--signal-ink); }
.paycard__ico svg { width: 18px; height: 18px; }
.paycard__txt { display: grid; gap: 10px; }
.paycard__txt > p { font-size: 15px; line-height: 1.5; font-weight: 500; }
.paycard__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.errcard { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; padding: 11px 14px; border: 1px solid var(--bad); border-radius: 10px; background: var(--bad-wash); color: var(--bad); font-size: 15px; line-height: 1.5; }
.errcard__ico svg { width: 20px; height: 20px; }
.errcard--page { grid-template-columns: auto minmax(0, 1fr); }
.errcard--page .btn { grid-column: 2; justify-self: start; }
.note { display: inline-flex; align-items: center; gap: 8px; font: 400 12.5px/1.4 var(--mono); color: var(--muted); }
.note svg { width: 15px; height: 15px; }

/* attachments: in the composer box (with progress) and on a sent message */
.atts { grid-area: atts; list-style: none; margin: 0; padding: 2px 2px 6px; display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.atts .att { flex: none; width: 248px; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; padding: 5px 2px 5px 5px; }
.atts .att__thumb, .atts .att__ico { width: 34px; height: 34px; }
.atts .att__err, .atts .att__meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the kind and size of an uploaded file are never cut: the line wraps after «·» (chat.js keeps «3,4 MB» together);
   only the name is cut, with … */
.atts .att--ferdig .att__meta { overflow: visible; white-space: normal; }
.atts .att--feil { width: 260px; max-width: 260px; }
.att { position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-width: 0; max-width: min(100%, 290px); padding: 6px 4px 6px 6px; background: var(--field); border: 1px solid var(--line-2); border-radius: 10px; }
.att--sent { grid-template-columns: 38px minmax(0, 1fr); padding-right: 12px; }
.att__link { display: contents; text-decoration: none; }
.att__thumb { width: 38px; height: 38px; border-radius: 7px; object-fit: cover; background: var(--paper-2); }
.att__ico { width: 38px; height: 38px; border-radius: 7px; background: var(--paper-2); color: var(--ink-2); }
.att__ico svg { width: 20px; height: 20px; }
.att__txt { min-width: 0; display: grid; gap: 2px; }
.att__name { font-weight: 600; font-size: 13.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att__meta { font: 400 11.5px/1.3 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.att__bar { width: 100%; height: 4px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 2px; background: var(--paper-2); overflow: hidden; }
.att__bar::-webkit-progress-bar { background: var(--paper-2); }
.att__bar::-webkit-progress-value { background: var(--signal); }
.att__bar::-moz-progress-bar { background: var(--signal); }
.att__err { font-size: 12.5px; line-height: 1.4; color: var(--bad); overflow-wrap: anywhere; white-space: normal; }
.att__err a { font-weight: 600; }
.att--feil { border-color: var(--bad); background: var(--bad-wash); grid-template-columns: 38px minmax(0, 1fr) auto; max-width: min(100%, 340px); }
.att--ferdig .att__meta::before { content: "✓\00a0"; color: var(--ok); }
.att__x { width: 30px; height: 30px; align-self: start; }
.att__x svg { width: 16px; height: 16px; }

/* ---------- empty state ---------- */
.empty { width: min(var(--col), 100% - 32px); margin: 0 auto; padding: clamp(28px, 9vh, 96px) 0 24px; display: grid; justify-items: center; gap: 14px; text-align: center; }
.empty__mark svg { width: 46px; height: 46px; }
.empty__h { margin: 4px 0 0; font-size: clamp(28px, 4.4vw, 42px); line-height: 1.05; letter-spacing: -0.035em; font-weight: 700; text-wrap: balance; }
.empty__lead { max-width: 52ch; font-size: 16.5px; line-height: 1.5; color: var(--ink-2); }
.empty__prop { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; margin-top: 4px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--sheet); font-size: 15.5px; }
.picker { position: relative; width: min(100%, 520px); margin-top: 8px; display: grid; gap: 6px; text-align: left; }
.picker__label { font: 500 11px/1.3 var(--mono); letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-2); }
.picker__box { position: relative; }
.picker input {
  width: 100%; min-width: 0; font: inherit; font-size: 16px; line-height: 1.4; color: var(--ink); background: var(--field); border: 1.5px solid var(--ink);
  border-radius: 10px; padding: 12px 14px; box-shadow: 6px 6px 0 -1px var(--paper-2), 6px 6px 0 0 var(--line-2);
}
.picker input::placeholder { color: var(--placeholder); }
.picker input:focus-visible { outline: 2px solid var(--signal-ink); outline-offset: 2px; }
.picker__msg { min-height: 1.3em; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); }
.suggest { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); background: var(--field); border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.5); }
.suggest button { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line); background: var(--field); text-align: left; font-size: 15px; cursor: pointer; }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover, .suggest button.on { background: var(--paper); }
.suggest button.on { box-shadow: inset 3px 0 0 var(--signal); }
.suggest small { flex: none; font: 400 12px var(--mono); color: var(--muted); }
.sugg { list-style: none; width: 100%; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sugg__b {
  width: 100%; height: 100%; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--sheet); text-align: left;
  font-size: 15px; line-height: 1.4; color: var(--ink-2); cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.sugg__b:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- composer ---------- */
.composer { flex: none; padding: 6px 16px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--paper) 78%, color-mix(in srgb, var(--paper) 0%, transparent)); }
.composer__in { position: relative; width: min(var(--col), 100%); margin: 0 auto; }
.box {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "atts atts atts" "attach input send";
  align-items: end; gap: 4px; padding: 6px; background: var(--field);
  border: 1.5px solid var(--ink); border-radius: 18px; box-shadow: 6px 6px 0 -1px var(--paper-2), 6px 6px 0 0 var(--line-2);
}
.box:focus-within { outline: 2px solid var(--signal-ink); outline-offset: 2px; }
.box textarea {
  display: block; width: 100%; min-height: 40px; max-height: 40vh; padding: 9px 4px; border: 0; outline: 0; resize: none; background: transparent;
  font: inherit; font-size: 16px; line-height: 1.45; color: var(--ink); overflow-y: auto;
}
.box textarea::placeholder { color: var(--placeholder); }
.box__attach { grid-area: attach; }
.box textarea { grid-area: input; }
.send { grid-area: send; }
.box__attach.is-locked { color: var(--muted); }
.is-limit .box { opacity: 0.75; }
.limit { display: grid; gap: 10px; margin-bottom: 10px; padding: 12px 14px; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--signal-wash); }
.limit__txt { font-size: 14.5px; line-height: 1.45; font-weight: 500; }
.limit__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.waiting { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; padding: 8px 12px; border: 1px dashed var(--line-2); border-radius: 10px; font-size: 13.5px; line-height: 1.4; color: var(--ink-2); background: var(--sheet); }
@media (pointer: coarse) { .composer__keys { display: none; } }
.send { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: var(--ink); color: var(--paper); cursor: pointer; transition: background 0.15s, color 0.15s; }
.send svg { width: 20px; height: 20px; }
.send:hover:not(:disabled) { background: var(--signal); color: var(--ink); }
.send:disabled { background: var(--line); color: var(--muted); cursor: default; }
.send__stop { display: none; }
.is-busy .send__go { display: none; }
.is-busy .send__stop { display: block; }
.composer__hint { margin-top: 8px; text-align: center; font: 400 11.5px/1.4 var(--mono); color: var(--muted); }
.composer__count { color: var(--signal-ink); }
.pop { position: absolute; left: 0; bottom: calc(100% + 10px); z-index: 25; width: min(360px, 100%); display: grid; gap: 10px; padding: 14px 44px 14px 16px; background: var(--sheet); border: 1.5px solid var(--ink); border-radius: 12px; box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.5); }
.pop__h { font-weight: 650; font-size: 15px; }
.pop__p { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.pop__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.pop__x { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; }
.drop { position: absolute; inset: 8px; z-index: 40; display: grid; place-items: center; border: 2px dashed var(--ink); border-radius: 16px; background: color-mix(in srgb, var(--paper) 90%, transparent); pointer-events: none; }
.drop__in { display: grid; justify-items: center; gap: 8px; padding: 24px; text-align: center; }
.drop__in svg { width: 40px; height: 40px; color: var(--signal-ink); }
.drop__h { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; }
.drop__p { font: 400 12.5px/1.4 var(--mono); color: var(--ink-2); }

/* ---------- dialogs ---------- */
.dlg { width: min(500px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--sheet); color: var(--ink); box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.5); }
.dlg::backdrop { background: rgba(16, 19, 22, 0.42); }
.dlg__in { display: grid; gap: 12px; padding: 20px; }
.dlg__h { margin: 0; font-size: 21px; line-height: 1.2; letter-spacing: -0.015em; }
.dlg__p { font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.dlg__row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dlg .picker { width: 100%; margin: 0; }
.dlg .suggest { position: static; margin-top: 6px; box-shadow: none; }

/* ---------- small screens: the sidebar is a drawer ---------- */
@media (max-width: 899px) {
  .app, .app.is-collapsed { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; width: min(86vw, 320px); transform: translateX(-102%);
    transition: transform 0.25s var(--ease), visibility 0s linear 0.25s; visibility: hidden; box-shadow: 18px 0 40px -24px rgba(0, 0, 0, 0.5);
  }
  .app.is-drawer .side { transform: none; visibility: visible; transition: transform 0.25s var(--ease); }
}
@media (max-width: 640px) {
  :root { --bar-h: 52px; }
  .bar { padding: 0 6px; gap: 4px; }
  .chip { max-width: calc(100vw - 104px); }
  .chip__sub { display: none; }
  .thread { width: calc(100% - 32px); gap: 22px; padding-top: 18px; }
  .msg--pk { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .avatar, .avatar svg { width: 24px; height: 24px; }
  .bubble { max-width: 88%; }
  .md { font-size: 15.5px; }
  .pcard__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pcard__facts > div:nth-child(3) { border-left: 0; }
  .pcard__facts > div:nth-child(n + 3) { border-top: 1px solid var(--line-2); }
  .fcard { grid-template-columns: 40px minmax(0, 1fr); }
  .fcard__ico { width: 40px; height: 40px; }
  .fcard__acts { grid-column: 1 / -1; justify-content: flex-start; }
  .sugg { grid-template-columns: minmax(0, 1fr); }
  .composer { padding-left: 10px; padding-right: 10px; }
  .box { box-shadow: none; border-radius: 16px; }
  .composer__hint { font-size: 10.5px; }
  .empty { width: calc(100% - 32px); }
  .empty__lead { font-size: 15.5px; }
  .att { max-width: 100%; }
  .edit { width: 100%; }
  .atts .att { width: 208px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .typing i { opacity: 0.6; transform: none; }
  .md.is-live > p:last-child::after { animation: none; }
  .spin, .tools.is-run .tools__spin { animation: none; }
}
@media (forced-colors: active) {
  .box, .pcard, .paycard, .chip, .sugg__b { border: 1px solid CanvasText; }
  .send { border: 1px solid ButtonText; }
}
@media print {
  body { overflow: visible; }
  .app { display: block; height: auto; }
  .side, .scrim, .bar, .composer, .tobottom, .msg__actions, .msg__edit, .drop { display: none !important; }
  .scroll { overflow: visible; }
}
@media (prefers-color-scheme: dark) {
  .avatar svg rect, .brand svg rect, .empty__mark svg rect { fill: #2a2f35; }
  .btn--bad { color: #121417; }
  .btn--bad:hover { color: var(--paper); }
  .md-table th { background: var(--paper-2); }
}
