/* =====================================================================
   Northgrounds theme — ENDA källan för layout, färger, fonter, animation.
   Byt utseende här (och bara här): tokens i :root styr allt.
   Body 12px, headers max 14px.
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');
:root {
  /* Codex-mörkt tema med Northgrounds-accenter */
  --ng-blue: #4b48ff; --ng-blue-deep: #1714C1;
  --electric-lime: #CDFF09; --soft-lime: #C1FF72;
  --night: #09090F; --steel: #9a9aa3;
  --sky: #3AC7F5; --pink: #FA1E6F;
  --bg: #0e0e13;            /* huvudbakgrund */
  --panel: #17171e;         /* paneler, boxar */
  --panel-2: #1e1e27;       /* hover / inre ytor */
  --line: #2a2a34;          /* avgränsare */
  --text: #e9e9ee; --white: #17171e; --cloud: #2a2a34;
  --radius: 16px; --radius-sm: 10px;
  --font-body: "Inter", Arial, sans-serif;
  --font-head: "Inter", Arial, sans-serif;
  --w-light: 300; --w-normal: 400; --w-medium: 500; --w-semi: 600;  /* aldrig 700+ */
  --fs-body: 12px; --fs-small: 11px; --fs-head: 14px;
  --shadow: 0 12px 34px rgba(0,0,0,.5);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
/* Dokumentet scrollar aldrig: all scroll sker i inre paneler (chat, sidofält,
   admin, setup-vyn). Vad som än spiller i body-flödet kan inte ge scrollbar –
   samma modell som setup-designfilens body{overflow:hidden}. */
body { font: 400 var(--fs-body)/1.55 var(--font-body); color: var(--text); background: var(--bg); }
body.app-authenticated > #authView { display: none !important; }
body.app-authenticated > #appView { display: flex !important; }
button { font-family: var(--font-body); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Brand ---------- */
.brand { font: var(--w-semi) 15px var(--font-body); letter-spacing: .2px; color: var(--text); padding: 2px 6px 14px; }
.brand-dark { color: var(--text); padding: 0 0 6px; }
.brand-n { position: relative; display: inline-block; }
.brand-dot { position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--electric-lime); }
.brand-dark .brand-dot { background: var(--electric-lime); }

/* ---------- Auth ---------- */
.auth-view { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.auth-bg { position: absolute; inset: 0;
  background:
    radial-gradient(55% 70% at 78% 20%, rgba(58,199,245,.26), transparent 62%),
    radial-gradient(42% 55% at 90% 88%, rgba(250,30,111,.12), transparent 65%),
    linear-gradient(158deg, #1c1ad4 0%, #12109c 42%, #0a0a38 100%);
  animation: drift 18s ease-in-out infinite alternate; }
.auth-bg::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 95% at 50% 42%, transparent 52%, rgba(4,4,18,.55) 100%); }
@keyframes drift { to { background-position: -60px 40px, 40px -30px; } }
.auth-card { position: relative; width: min(400px, 92vw); background: var(--panel);
  border: 1px solid var(--line); color: var(--text);
  border-radius: 20px; padding: 26px 28px; box-shadow: var(--shadow);
  animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.auth-card h1 { font: var(--w-semi) var(--fs-head) var(--font-head); margin: 8px 0 2px; }
.auth-sub { color: var(--steel); margin: 0 0 14px; }
.auth-form label { display: block; margin-bottom: 10px; font-weight: var(--w-medium); }
.auth-form input { display: block; width: 100%; margin-top: 3px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
  color: var(--text); padding: 8px 10px; font: 400 var(--fs-body) var(--font-body); outline: 0; }
.auth-form input:focus { border-color: var(--ng-blue); }
.auth-form button { width: 100%; margin-top: 4px; font-weight: var(--w-medium);
  background: var(--electric-lime); color: var(--night); border: 0;
  border-radius: var(--radius-sm); padding: 10px; cursor: pointer; transition: transform .12s; }
.auth-form button:hover { transform: translateY(-1px); }
.auth-error { color: var(--pink); min-height: 15px; margin: 8px 0 0; }
.auth-foot { color: var(--steel); font-size: var(--fs-small); margin: 14px 0 0; }

/* ---------- Layout ---------- */
.layout { display: flex; width: 100%; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.sidebar { width: 240px; min-width: 240px; height: 100%; min-height: 0; overflow: hidden; background: var(--panel); color: var(--text);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 12px 10px; }
.new-chat { font: var(--w-normal) var(--fs-body) var(--font-body); color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 7px 10px; cursor: pointer; transition: background .15s; }
.new-chat:hover { background: #262630; border-color: #3a3a46; }
.side-section { margin-top: 14px; min-height: 0; display: flex; flex-direction: column; }
.side-section.grow { flex: 1; }
.side-head { font: var(--w-medium) 10px var(--font-head); letter-spacing: .8px; text-transform: uppercase;
  color: var(--steel); padding: 0 6px 4px; display: flex; align-items: center; }
.side-add { margin-left: auto; background: none; border: 0; color: var(--steel);
  font-size: 13px; cursor: pointer; line-height: 1; padding: 0 2px; }
.side-add:hover { color: var(--electric-lime); }
.project-list, .conv-list { overflow-y: auto; min-height: 0; }
.conv-list { flex: 1; }
.p-item, .conv-item { display: flex; align-items: center; gap: 6px; padding: 5px 8px;
  margin-bottom: 2px; border-radius: var(--radius-sm); color: var(--text);
  cursor: pointer; white-space: nowrap; overflow: hidden; }
.p-item span.t, .conv-item span.t { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.p-item:hover, .conv-item:hover { background: var(--panel-2); }
.p-item.active, .conv-item.active { background: #262630; }
.p-item .pd { width: 5px; height: 5px; border-radius: 50%; background: var(--sky); }
.conv-item.nested { margin-left: 14px; color: var(--steel); }
.conv-item.nested:hover { color: var(--text); }
.del { background: none; border: 0; color: var(--steel); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0 2px; visibility: hidden; }
.p-item:hover .del, .conv-item:hover .del { visibility: visible; }
.del:hover { color: var(--text); }
.sidebar-foot { padding-top: 10px; border-top: 1px solid var(--line); }
.foot-btn { width: 100%; display: flex; align-items: center; gap: 7px;
  font: var(--w-normal) var(--fs-body) var(--font-body); color: var(--text); background: none;
  border: 0; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.foot-btn:hover { background: var(--panel-2); }
.dot { width: 6px; height: 6px; border-radius: 50%; }
.dot.lime { background: var(--soft-lime); } .dot.cyan { background: var(--sky); }
.foot-count { margin-left: auto; color: var(--steel); font-size: var(--fs-small); }

/* ---------- Topbar ---------- */
.main { flex: 1; width: 0; height: 100%; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  border-bottom: 1px solid var(--line); background: var(--panel); }
.top-left { display: flex; gap: 10px; align-items: center; min-width: 0; flex: 1; }
.chip { font-size: var(--fs-small); color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.top-center { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-center h1 { font: var(--w-semi) var(--fs-head)/1.2 var(--font-head); margin: 0; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.badge { font-size: var(--fs-small); font-weight: var(--w-medium); color: #a9a7ff;
  background: rgba(75,72,255,.12); border: 1px solid rgba(75,72,255,.35);
  border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.badge.b-llm { color: var(--electric-lime); background: rgba(205,255,9,.08); border-color: rgba(205,255,9,.35); }
.top-right { display: flex; align-items: center; gap: 6px; }
.user-chip { display: flex; align-items: center; gap: 7px; background: none; border: 0;
  cursor: pointer; font: var(--w-normal) var(--fs-body) var(--font-body); color: var(--text);
  padding: 3px 6px; border-radius: 999px; transition: background .15s; }
.user-chip:hover { background: var(--panel-2); }
.avatar { display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; font: var(--w-medium) 10px var(--font-head); }
.av-user { background: #2e2e3a; color: var(--soft-lime); }
.av-ai { background: var(--ng-blue-deep); color: #fff; position: relative; }
.av-ai::after { content: ""; position: absolute; top: 2px; right: 2px; width: 4px; height: 4px;
  border-radius: 50%; background: var(--soft-lime); }

/* ---------- Messages ---------- */
.messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 20px 0 8px; scroll-behavior: smooth; overscroll-behavior: contain; }
.msg { max-width: 860px; margin: 0 auto 16px; padding: 0 22px; display: flex; gap: 10px;
  animation: msgIn .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } }
.msg .avatar { flex: none; margin-top: 2px; }
.msg .body { min-width: 0; max-width: 78%; display: flex; flex-direction: column; }
.msg .who { font: var(--w-medium) var(--fs-small) var(--font-head); color: var(--steel); margin-bottom: 3px;
  display: flex; gap: 8px; align-items: baseline; }
.model-tag { font: var(--w-normal) 10px var(--font-body); color: var(--steel); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; text-transform: none; letter-spacing: 0; }
/* Din chatt: vänster. AI:ns chatt: höger. Båda i tydliga boxar. */
.msg.user { justify-content: flex-start; }
.msg.assistant { flex-direction: row-reverse; }
.msg.assistant .body { align-items: flex-end; }
.msg.assistant .who { flex-direction: row-reverse; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; width: 100%; }
.msg.user .box { border-radius: 4px var(--radius) var(--radius) var(--radius); }
.msg.assistant .box { border-radius: var(--radius) 4px var(--radius) var(--radius);
  background: linear-gradient(var(--panel), var(--panel)) padding-box; }
.msg.assistant .box, .msg.assistant .box .bubble { text-align: left; }
.msg .bubble { min-width: 0; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 4px 0 8px; padding-left: 18px; }
.bubble code { font: 11px ui-monospace, Menlo, Consolas, monospace; background: var(--panel-2); color: var(--soft-lime);
  border-radius: 4px; padding: 1px 4px; }
.bubble pre { background: #0a0a10; border: 1px solid var(--line); color: var(--text); border-radius: var(--radius-sm);
  padding: 10px 12px; overflow-x: auto; font-size: 11px; }
.bubble pre code { background: none; color: inherit; padding: 0; }

/* Live-steg medan den tänker */
.steps { border-left: 2px solid rgba(75,72,255,.5); margin: 2px 0 8px; padding: 2px 0 2px 10px; }
.step { color: var(--steel); font-size: var(--fs-small); display: flex; gap: 6px;
  align-items: baseline; animation: stepIn .3s ease both; padding: 1px 0; }
@keyframes stepIn { from { opacity: 0; transform: translateX(-6px); } }
.step .s-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ng-blue);
  flex: none; position: relative; top: -1px; }
.step:last-child .s-dot { animation: pulse 1s ease-in-out infinite; }
.steps.done .step .s-dot { animation: none; background: var(--soft-lime); }
@keyframes pulse { 50% { opacity: .25; } }
.steps-summary { color: var(--steel); font-size: var(--fs-small); cursor: pointer;
  margin: 0 0 6px; display: inline-flex; gap: 5px; align-items: center; }
.steps-summary:hover { color: var(--soft-lime); }

/* Källor, kontext, actions */
.ctx { margin-top: 8px; color: var(--steel); font-size: var(--fs-small); border-top: 1px dashed var(--line); padding-top: 6px; }
.sources { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.source-chip { font-size: var(--fs-small); color: #b9b8ff; background: var(--panel-2);
  border: 1px solid rgba(75,72,255,.4); border-radius: 999px; padding: 2px 10px;
  cursor: pointer; transition: transform .12s, background .15s; }
.source-chip:hover { background: rgba(75,72,255,.15); transform: translateY(-1px); }
.source-detail { width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 11px; margin-top: 2px; animation: msgIn .25s both; }
.source-detail .path { color: var(--steel); font-size: var(--fs-small); margin-bottom: 4px; }
.source-detail .snippet { white-space: pre-wrap; }
.open-file { margin-top: 6px; font: var(--w-medium) var(--fs-small) var(--font-body); color: #fff;
  background: var(--ng-blue-deep); border: 0; border-radius: 999px; padding: 3px 11px; cursor: pointer; }
.open-file:hover { background: var(--ng-blue-deep); }
.actions { margin-top: 7px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.msg.assistant:hover .actions, .actions.stay { opacity: 1; }
.act { background: none; border: 1px solid transparent; border-radius: 7px; padding: 2px 7px;
  cursor: pointer; color: var(--steel); font-size: 12px; line-height: 1.3; transition: all .15s; }
.act:hover { color: var(--text); border-color: var(--line); background: var(--panel-2); }
.act.on-up { color: var(--soft-lime); } .act.on-down { color: var(--pink); }

/* Tomläge */
.empty { position: relative; max-width: 760px; margin: 10vh auto 0; padding: 0 22px; color: var(--steel); }
.empty-glow { position: absolute; top: -50px; right: 8%; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(58,199,245,.20), rgba(250,30,111,.10) 60%, transparent 70%);
  filter: blur(6px); animation: drift 14s ease-in-out infinite alternate; pointer-events: none; }
.empty-title { font: var(--w-semi) var(--fs-head) var(--font-head); color: var(--text); margin: 0 0 6px; }
.lime-dot { color: transparent; position: relative; }
.lime-dot::after { content: ""; position: absolute; left: 1px; bottom: 2px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--electric-lime); }

/* ---------- Composer ---------- */
.composer-wrap { flex: 0 0 auto; padding: 10px 22px 16px; background: linear-gradient(transparent, var(--bg) 40%); }
.composer { max-width: 860px; margin: 0 auto; display: grid;
  grid-template-columns: auto 1fr auto auto auto; grid-template-rows: auto auto;
  gap: 4px 8px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  padding: 10px 12px; transition: border-color .15s, box-shadow .2s; }
.composer:focus-within { border-color: #3d3d4c; box-shadow: 0 8px 26px rgba(0,0,0,.35); }
.composer textarea { grid-column: 1 / -1; border: 0; outline: 0; resize: none;
  font: 400 var(--fs-body)/1.5 var(--font-body); max-height: 140px; padding: 4px 6px;
  background: none; color: var(--text); }
.composer textarea::placeholder { color: var(--steel); }
.composer textarea:focus, .composer textarea:focus-visible { outline: none; }
.attach { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  background: none; color: var(--steel); font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .15s; }
.attach:hover { color: var(--text); border-color: #3d3d4c; }
.model-label { grid-column: 3; font-size: var(--fs-small); color: var(--steel); white-space: nowrap; }
.model-label strong { color: var(--text); font-weight: var(--w-medium); }
.composer button[type=submit] { grid-column: 5; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: var(--electric-lime); color: var(--night); cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: transform .12s; }
.composer button[type=submit]:hover { transform: scale(1.06); }
.composer button:disabled { opacity: .5; cursor: default; transform: none; }
.mic { grid-column: 4; border: 0; background: none; color: var(--steel);
  border-radius: 50%; width: 30px; height: 30px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .15s; }
.mic:hover { color: var(--text); background: var(--panel-2); }
.mic.rec { color: var(--white); background: var(--pink); border-color: var(--pink);
  animation: recPulse 1.1s ease-in-out infinite; }
@keyframes recPulse { 50% { box-shadow: 0 0 0 6px rgba(250,30,111,.15); } }
.composer-hint { max-width: 860px; margin: 5px auto 0; color: var(--steel);
  font-size: var(--fs-small); text-align: right; }

/* ---------- Fly-in ---------- */
.flyin { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 30; }
.flyin[hidden] { display: none; }
.flyin-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(430px, 94vw);
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(0,0,0,.5);
  display: flex; flex-direction: column; animation: flyIn .3s cubic-bezier(.2,.8,.2,1) both; }
@keyframes flyIn { from { transform: translateX(40px); opacity: 0; } }
.flyin-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.flyin-head h2 { font: var(--w-semi) var(--fs-head) var(--font-head); margin: 0; }
.flyin-tabs { display: flex; gap: 4px; padding: 0 18px 8px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: none; font: var(--w-normal) var(--fs-body) var(--font-body); color: var(--steel);
  padding: 5px 10px; border-radius: 8px 8px 0 0; cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--soft-lime); border-bottom-color: var(--soft-lime); font-weight: var(--w-medium); }
.flyin-body { flex: 1; overflow-y: auto; padding: 14px 18px 18px; }
.flyin-body h3 { font: var(--w-medium) var(--fs-body) var(--font-head); margin: 12px 0 4px; }
.flyin-body label { display: block; margin-bottom: 9px; font-weight: var(--w-medium); }
.flyin-body input, .flyin-body select, .flyin-body textarea { display: block; width: 100%;
  margin-top: 3px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px 9px; font: 400 var(--fs-body) var(--font-body); outline: 0;
  background: var(--panel-2); color: var(--text); }
.flyin-body input:focus, .flyin-body select:focus { border-color: var(--ng-blue); }
.btn { font: var(--w-medium) var(--fs-body) var(--font-body); border: 0; border-radius: var(--radius-sm);
  padding: 8px 14px; cursor: pointer; }
.btn.primary { background: var(--ng-blue-deep); color: #fff; }
.btn.primary:hover { background: var(--ng-blue-deep); }
.btn.lime { background: var(--electric-lime); color: var(--night); }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.muted { color: var(--steel); font-size: var(--fs-small); }
.ok-note { color: var(--soft-lime); font-size: var(--fs-small); min-height: 14px; }
.timeline { border-left: 2px solid rgba(75,72,255,.5); padding-left: 12px; margin: 6px 0; }
.tl-item { position: relative; padding: 3px 0; }
.tl-item::before { content: ""; position: absolute; left: -16px; top: 9px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--ng-blue); }
.tl-item .t { color: var(--steel); font-size: 10px; }
.kv { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
.kv .k { font-size: var(--fs-small); background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 9px; }

/* ---------- Paneler (dokument, filvisare) ---------- */
.panel { position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 20; }
.panel[hidden] { display: none; }
.panel-card { width: min(640px, 92vw); max-height: 86vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  animation: rise .3s cubic-bezier(.2,.8,.2,1) both; }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { font: var(--w-semi) var(--fs-head) var(--font-head); margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver { font: var(--w-normal) 10px var(--font-body); color: var(--steel); vertical-align: 2px; }
.close { border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--steel); }
.close:hover { color: var(--text); }
.viewer-card { width: min(980px, 96vw); height: 90vh; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column;
  animation: rise .3s both; }
.viewer-body { flex: 1; margin-top: 8px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; }
.viewer-body pre { margin: 0; padding: 14px; height: 100%; overflow: auto; color: var(--night);
  font: 11px ui-monospace, Menlo, monospace; white-space: pre-wrap; background: #fff; }

/* Dropzone + uppladdning (som tidigare) */
.dropzone { margin-top: 12px; border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 18px 16px; text-align: center; cursor: pointer; transition: all .2s; }
.dropzone:hover, .dropzone:focus-visible { border-color: var(--ng-blue); }
.dropzone.drag { border-color: var(--ng-blue); background: rgba(23,20,193,.05); }
.dz-ring { width: 32px; height: 32px; margin: 0 auto 8px; border-radius: 50%;
  background: rgba(75,72,255,.15); display: flex; align-items: center; justify-content: center;
  transition: transform .2s; }
.dropzone.drag .dz-ring { transform: scale(1.12); }
.dz-plus { color: #b9b8ff; font: var(--w-medium) 16px/1 var(--font-body); }
.dz-actions { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
.dz-btn { font: var(--w-medium) var(--fs-body) var(--font-body); color: #fff; background: var(--ng-blue-deep);
  border: 0; border-radius: var(--radius-sm); padding: 7px 16px; cursor: pointer; transition: background .15s; }
.dz-btn:hover { background: var(--ng-blue-deep); }
.dz-title { margin: 0; } .dz-hint { margin: 3px 0 0; color: var(--steel); font-size: var(--fs-small); }
.upload-list { margin-top: 10px; }
.u-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center;
  padding: 7px 2px; border-bottom: 1px solid var(--line); animation: rowIn .3s ease both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } }
.u-status { font-size: 10px; font-weight: var(--w-medium); text-align: center; border-radius: 999px;
  padding: 2px 0; background: var(--panel-2); color: var(--steel); transition: all .25s; }
.u-row.s-uploading .u-status, .u-row.s-indexing .u-status { background: rgba(23,20,193,.10); color: var(--ng-blue); }
.u-row.s-indexed .u-status { background: rgba(193,255,114,.15); color: var(--soft-lime); }
.u-row.s-failed .u-status { background: rgba(250,30,111,.12); color: #a30f47; }
.u-row.s-unsupported .u-status { background: rgba(160,164,173,.18); color: var(--steel); }
.u-row.s-indexed .u-status, .u-row.s-failed .u-status { animation: pop .25s ease; }
@keyframes pop { 50% { transform: scale(1.12); } }
.u-name { min-width: 0; }
.u-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-bar { height: 3px; border-radius: 2px; background: var(--panel-2); margin-top: 4px;
  overflow: hidden; opacity: 0; transition: opacity .2s; }
.u-row.s-uploading .u-bar, .u-row.s-indexing .u-bar { opacity: 1; }
.u-bar > div { height: 100%; width: 0; background: var(--ng-blue); border-radius: 2px; transition: width .15s; }
.u-row.s-indexing .u-bar > div { width: 100% !important;
  background: linear-gradient(90deg, var(--ng-blue) 40%, var(--soft-lime), var(--ng-blue) 60%);
  background-size: 200% 100%; animation: sweep 1.2s linear infinite; }
@keyframes sweep { to { background-position: -200% 0; } }
.u-detail { color: var(--steel); font-size: var(--fs-small); white-space: nowrap; }
.server-dir { margin-top: 14px; }
.server-dir summary { cursor: pointer; color: var(--steel); font-size: var(--fs-small); user-select: none; }
.server-dir .dir-row { margin-top: 8px; }
.dir-row { display: flex; gap: 8px; }
.dir-row input { flex: 1; font: 400 var(--fs-body) var(--font-body); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 7px 10px; outline: 0; background: var(--panel-2); color: var(--text); }
.dir-row input:focus { border-color: var(--ng-blue); }
.index-btn { font: var(--w-medium) var(--fs-body) var(--font-body); background: var(--ng-blue-deep); color: #fff;
  border: 0; border-radius: var(--radius-sm); padding: 7px 14px; cursor: pointer; }
.index-btn:disabled { opacity: .6; cursor: default; }
.index-status { margin-top: 10px; color: var(--steel); font-size: var(--fs-small); min-height: 16px; }
.progress { height: 4px; border-radius: 2px; background: var(--panel-2); overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: var(--ng-blue); transition: width .3s; }
.file-list { margin-top: 12px; }
.file-row { display: flex; gap: 8px; align-items: baseline; padding: 5px 0;
  border-bottom: 1px solid var(--line); cursor: pointer; }
.file-row:hover .fname { color: var(--soft-lime); }
.file-row .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .15s; }
.file-row .fdetail { color: var(--steel); font-size: var(--fs-small); }
.status-pill { font-size: 10px; font-weight: var(--w-medium); border-radius: 999px; padding: 1px 8px; }
.status-indexed { background: rgba(193,255,114,.15); color: var(--soft-lime); }
.status-skipped { background: var(--panel-2); color: var(--steel); }
.status-failed { background: rgba(250,30,111,.12); color: #a30f47; }
.status-unsupported { background: rgba(160,164,173,.18); color: var(--steel); }
.status-removed { background: var(--panel-2); color: var(--steel); }

::selection { background: var(--soft-lime); color: var(--night); }
button:focus-visible, input:focus-visible, .conv-item:focus-visible, .p-item:focus-visible {
  outline: 2px solid var(--ng-blue); outline-offset: 1px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 860px) {
  .top-left .chip:not(#clockChip) { display: none; }
  .sidebar { width: 180px; min-width: 180px; }
}

strong, b { font-weight: var(--w-semi); }

/* ============== Rörelsesystem: allt ska glida, inget ska klippa ============== */
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes flyOut { to { transform: translateX(40px); opacity: 0; } }
@keyframes sink { to { opacity: 0; transform: translateY(14px) scale(.99); } }
.auth-view, .layout { animation: fadeIn .4s ease both; }
.flyin { animation: fadeIn .25s ease both; }
.flyin.closing { animation: fadeOut .22s ease both; }
.flyin.closing .flyin-panel { animation: flyOut .22s ease both; }
.panel { animation: fadeIn .25s ease both; }
.panel.closing { animation: fadeOut .22s ease both; }
.panel.closing .panel-card, .panel.closing .viewer-card { animation: sink .22s ease both; }
.messages.swap { animation: fadeOut .16s ease both; }
.flyin-body > * { animation: msgIn .3s ease both; }
.tab-swap { animation: msgIn .25s ease both; }
.source-chip { animation: msgIn .3s ease backwards; }
.sources .source-chip:nth-child(2) { animation-delay: .05s; }
.sources .source-chip:nth-child(3) { animation-delay: .1s; }
.sources .source-chip:nth-child(4) { animation-delay: .15s; }
.sources .source-chip:nth-child(5) { animation-delay: .2s; }

/* AI-närvaro medan svaret skapas: glödande ram, pulserande avatar, skrivmarkör */
@keyframes aiGlow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(75,72,255,.35), 0 0 22px rgba(75,72,255,.10); }
  50% { box-shadow: 0 0 0 1px rgba(193,255,114,.4), 0 0 26px rgba(193,255,114,.10); }
}
.msg.assistant.streaming .box { animation: aiGlow 2.2s ease-in-out infinite; border-color: transparent; }
@keyframes avPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(75,72,255,.5); } 70% { box-shadow: 0 0 0 7px rgba(75,72,255,0); } }
.msg.assistant.streaming .av-ai { animation: avPulse 1.6s ease-out infinite; }
.msg.assistant.streaming .bubble > p:last-child::after {
  content: "▍"; color: var(--soft-lime); animation: pulse 1s steps(2) infinite; margin-left: 1px; }
@keyframes shimmer { to { background-position: -180% 0; } }
.steps .step:last-child span:last-child {
  background: linear-gradient(90deg, var(--steel) 35%, #fff 50%, var(--steel) 65%);
  background-size: 180% 100%; -webkit-background-clip: text; background-clip: text;
  color: transparent; animation: shimmer 1.6s linear infinite; }
.steps.done .step span:last-child { background: none; color: var(--steel); animation: none; }

/* Diskret ambient bakgrund i chatten */
.messages { position: relative; }
.messages::before { content: ""; position: fixed; top: 10%; right: 6%; width: 340px; height: 340px;
  border-radius: 50%; pointer-events: none; z-index: 0; filter: blur(30px);
  background: radial-gradient(circle, rgba(75,72,255,.10), rgba(250,30,111,.05) 55%, transparent 70%);
  animation: drift 22s ease-in-out infinite alternate; }
.msg { position: relative; z-index: 1; }

/* ============== Uppläsning: vågpopup ============== */
.tts-overlay { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  z-index: 40; display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 16px; box-shadow: var(--shadow); animation: rise .3s ease both; }
.tts-overlay.closing { animation: sink .2s ease both; }
.tts-wave { display: flex; align-items: center; gap: 3px; height: 22px; }
.tts-wave i { width: 3px; border-radius: 2px; background: var(--soft-lime); height: 30%;
  animation: wave 1s ease-in-out infinite; }
.tts-wave i:nth-child(2) { animation-delay: .12s; background: var(--electric-lime); }
.tts-wave i:nth-child(3) { animation-delay: .24s; }
.tts-wave i:nth-child(4) { animation-delay: .36s; background: var(--electric-lime); }
.tts-wave i:nth-child(5) { animation-delay: .48s; }
.tts-wave i:nth-child(6) { animation-delay: .6s; background: var(--electric-lime); }
.tts-wave i:nth-child(7) { animation-delay: .72s; }
@keyframes wave { 0%,100% { height: 22%; } 50% { height: 100%; } }
.tts-label { color: var(--text); font-size: var(--fs-small); }
.tts-stop { border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  border-radius: 999px; padding: 4px 12px; cursor: pointer; font: var(--w-medium) var(--fs-small) var(--font-body); }
.tts-stop:hover { border-color: var(--pink); color: var(--pink); }

/* Stopp-läge på skicka-knappen */
.composer button[type=submit].stop { background: var(--pink); color: #fff; }
.composer button[type=submit].stop svg { display: none; }
.composer button[type=submit].stop::after { content: ""; width: 10px; height: 10px;
  background: #fff; border-radius: 2px; display: block; }
.conv-item.more .t { color: var(--steel); font-size: var(--fs-small); }
.file-row .frm { background: none; border: 0; color: var(--steel); cursor: pointer;
  font-size: 13px; visibility: hidden; }
.file-row:hover .frm { visibility: visible; }
.file-row .frm:hover { color: var(--pink); }

.auth-links { margin: 10px 0 0; font-size: var(--fs-small); }
.auth-links a { color: var(--steel); text-decoration: none; }
.auth-links a:hover { color: var(--soft-lime); }

/* ===== v0.25: Microsoft-inloggning ===== */
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px;
  color: var(--muted, #8a8f98); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px;
  background: var(--line, #2a2a34); }
.ms-btn { display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; background: #fff; color: #1b1b1f; border: 1px solid var(--line, #2a2a34);
  border-radius: 10px; padding: 10px 14px; font-weight: 500; cursor: pointer; }
.ms-btn:hover { filter: brightness(0.96); }

/* v0.25.1: metodval i setup */
.setup-mode { display: flex; gap: 8px; margin: 10px 0; }
.mode-btn { flex: 1; padding: 9px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line, #2a2a34); background: transparent;
  color: inherit; font-weight: 500; }
.mode-btn.active { border-color: var(--lime, #CDFF09); background: rgba(205,255,9,.08); }

/* v0.26: connect-checklista + site-väljare */
.ms-steps { margin: 10px 0; }
.ms-step { padding: 4px 0; font-size: 12px; border-bottom: 1px dashed var(--line, #2a2a34); }
.sp-hit { cursor: pointer; }
.sp-hit:hover { background: rgba(205,255,9,.06); }

/* ===== v0.27: first-run-guiden ===== */
.wiz-view h1 { font-size: 14px; margin: 12px 0 6px; }
.wiz-view h2 { font-size: 13px; margin: 10px 0 6px; }
.progress { display: flex; gap: 8px; margin: 4px 0 12px; }
.step-dot { width: 9px; height: 9px; border-radius: 50%;
  background: var(--line, #2a2a34); transition: background .25s; }
.step-dot.on { background: var(--lime, #CDFF09); }
.wiz-code { font-size: 22px; font-weight: 700; letter-spacing: 3px;
  padding: 8px 12px; border: 1px dashed var(--line, #2a2a34);
  border-radius: 10px; display: inline-block; }

/* ===== v0.28.1: adminmeny som expanderande vänsterträd ===== */
.ad-layout { display: flex; gap: 20px; align-items: flex-start; }
.ad-nav { flex: 0 0 210px; position: sticky; top: 0; align-self: flex-start;
  border-right: 1px solid var(--line, #2a2a34); padding-right: 12px; }
.ad-group { margin-bottom: 4px; }
.ad-grp-head { display: flex; width: 100%; align-items: center;
  justify-content: space-between; gap: 8px; background: transparent; border: 0;
  color: var(--muted, #8a8f98); font-size: 10px; text-transform: uppercase;
  letter-spacing: .06em; padding: 8px 6px 6px; cursor: pointer; }
.ad-grp-head svg { transition: transform .25s ease; }
.ad-group.open .ad-grp-head svg { transform: rotate(180deg); }
.ad-grp-items { overflow: hidden; max-height: 0; transition: max-height .25s ease; }
.ad-group.open .ad-grp-items { max-height: 260px; }
.ad-grp-items button { display: block; width: 100%; text-align: left;
  border: 0; background: transparent; color: inherit; border-radius: 8px;
  padding: 6px 10px; font-size: 12px; cursor: pointer; }
.ad-grp-items button:hover { background: rgba(255,255,255,.05); }
.ad-grp-items button.active { background: rgba(205,255,9,.09);
  color: var(--lime, #CDFF09); }
.ad-content { flex: 1; min-width: 0; }
.ad-sec { display: none; }
.ad-sec.active { display: block; }
.conn-card { border: 1px solid var(--line, #2a2a34); border-radius: 12px;
  padding: 8px 10px; margin: 8px 0; }

/* ===== v0.28: bred admin, collapse-meny, logo, ikoner ===== */
.flyin-panel { width: min(1100px, 94vw); transition: width .25s ease; }
.ad-sec .kv { max-width: 900px; }

.sidebar { transition: width .25s ease, padding .25s ease; position: relative; }
.nav-collapse { position: absolute; top: 10px; right: -12px; z-index: 5;
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line, #2a2a34); background: var(--bg, #0d0d12);
  color: inherit; cursor: pointer; }
.nav-collapse svg { transition: transform .25s ease; }
body.nav-collapsed .nav-collapse svg { transform: rotate(180deg); }
body.nav-collapsed .sidebar { width: 56px; min-width: 56px;
  padding-left: 8px; padding-right: 8px; }
body.nav-collapsed .sidebar .lbl,
body.nav-collapsed .sidebar .side-section,
body.nav-collapsed .sidebar .brand { opacity: 0; pointer-events: none;
  height: 0; overflow: hidden; margin: 0; transition: opacity .2s ease; }
body.nav-collapsed .new-chat, body.nav-collapsed .foot-btn {
  justify-content: center; padding-left: 0; padding-right: 0; }
.new-chat .ico, .foot-btn .ico { flex: 0 0 auto; vertical-align: -2px; }
.foot-btn { display: flex; align-items: center; gap: 7px; }
.new-chat { display: flex; align-items: center; gap: 7px; justify-content: center; }

.brand-img { display: block; width: 100%; max-height: 44px; object-fit: contain;
  object-position: left center; }
.brand-preview { max-width: 260px; max-height: 60px; display: block;
  margin: 6px 0; background: rgba(255,255,255,.06); border-radius: 8px; padding: 6px; }

/* ===== v0.28.4: kompakt chattlista med ikoner (Claude-stil) ===== */
.p-item, .conv-item { font-size: 11px; line-height: 1.35; padding: 3px 8px;
  margin-bottom: 1px; color: var(--steel, #A0A4AD); }
.p-item:hover, .conv-item:hover, .p-item.active, .conv-item.active {
  color: var(--text); }
.row-ico { flex: 0 0 auto; opacity: .55; }
.p-item:hover .row-ico, .conv-item:hover .row-ico,
.p-item.active .row-ico, .conv-item.active .row-ico { opacity: .9; }
.conv-item.more { font-size: 10.5px; color: var(--muted, #8a8f98); }
.side-head { font-size: 9.5px; opacity: .8; }

/* ===== v0.30: notiser, bilaga, autoläs ===== */
.notif { position: relative; cursor: pointer; border: 0; }
.notif-badge { position: absolute; top: -4px; right: -4px; background: var(--lime, #CDFF09);
  color: #111; border-radius: 8px; font-size: 9px; font-weight: 700;
  padding: 1px 4px; min-width: 14px; text-align: center; }
.notif-panel { position: absolute; top: 44px; right: 120px; z-index: 60;
  width: 340px; max-height: 380px; overflow-y: auto; background: var(--panel, #17171d);
  border: 1px solid var(--line, #2a2a34); border-radius: 12px; padding: 6px;
  box-shadow: 0 12px 30px rgba(0,0,0,.45); }
.notif-item { padding: 8px 10px; border-bottom: 1px solid var(--line, #2a2a34);
  font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: rgba(205,255,9,.05); }
.notif-time { font-size: 10px; color: var(--muted, #8a8f98); }
.clip-chip { font-size: 11px; color: var(--muted, #8a8f98); padding: 4px 2px; }
.clip-chip a { color: var(--lime, #CDFF09); }
#autoSpeak.on { color: var(--lime, #CDFF09); }

/* v0.31: röstläge */
body.voice-listening #autoSpeak, #autoSpeak.on { color: var(--lime, #CDFF09); }
body.voice-listening #input { box-shadow: 0 0 0 1px var(--lime, #CDFF09) inset; }
body.voice-listening #autoSpeak { animation: voicePulse 1.4s ease infinite; }
@keyframes voicePulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* v0.32: källkort, dropzon, artifacts */
.src-cards { display: flex; gap: 10px; margin: 8px 0; }
.src-card { flex: 1; text-align: left; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line, #2a2a34); background: transparent; color: inherit;
  cursor: pointer; font-size: 13px; }
.src-card span { display: block; font-size: 11px; color: var(--muted, #8a8f98); margin-top: 3px; }
.src-card:hover { border-color: var(--lime, #CDFF09); }
.drop-zone { border: 2px dashed var(--line, #2a2a34); border-radius: 14px;
  padding: 22px; text-align: center; color: var(--muted, #8a8f98); margin: 8px 0; }
.drop-zone.over { border-color: var(--lime, #CDFF09); color: var(--text); }
.drop-btns { margin-top: 10px; display: flex; gap: 8px; justify-content: center; }
.sp-pick { cursor: pointer; }
.sp-pick:hover { background: rgba(205,255,9,.06); }
.artifact { background: rgba(255,255,255,.03); border: 1px solid var(--line, #2a2a34);
  border-radius: 12px; padding: 10px; margin: 8px 0; overflow-x: auto; }
.artifact-title { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.artifact svg { max-width: 100%; height: auto; }

/* v0.35: statuskort */
.status-card p { margin: 4px 0 8px; font-size: 12px; }
.st-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 7px; vertical-align: -1px; }
.st-grp { margin: 6px 0; font-size: 12px; }
.st-item { color: var(--steel, #A0A4AD); padding: 2px 0 0 6px; }

/* v0.36: filserver + filexport + chattytans skugga */
.file-chip { display: inline-block; margin: 6px 0; padding: 7px 12px;
  border: 1px solid var(--lime, #CDFF09); border-radius: 10px;
  color: var(--lime, #CDFF09); font-size: 12px; text-decoration: none; }
.file-chip:hover { background: rgba(205,255,9,.08); }
.chat-area, .messages { box-shadow: inset 0 0 60px rgba(0,0,0,.35); }


/* Uppladdning etapp 1: progressbar, radstatus, totalrad, SP-bekräftelse */
.up-bar { height: 6px; border-radius: 3px; background: var(--line);
  overflow: hidden; margin-top: 8px; }
.up-fill { height: 100%; width: 0; background: var(--ng-blue);
  transition: width .2s; }
.up-st { white-space: nowrap; }
.src-total { border-top: 1px solid var(--line); font-weight: 600; }
.sp-confirm { border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; margin: 8px 0; background: rgba(23,20,193,.04); }
.sp-confirm .btn { margin-right: 6px; margin-top: 4px; }


/* Port Del 1: BP:s upload_anim + access-sektion, Northgrounds-tokens
   (Blue #1714C1 primär, lime endast accent, 16px-radier enligt brand) */
.src-adv { margin: 8px 0; }
.src-adv summary { cursor: pointer; font-size: 12px; font-weight: 600; }
.src-adv .chk { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.up-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 16px; margin-bottom: 8px;
  font-size: 12px; background: var(--panel, #fff); }
.up-ic { width: 34px; height: 34px; border-radius: 11px; display: grid;
  place-items: center; background: rgba(23,20,193,.06); font-size: 16px;
  flex: 0 0 auto; }
.up-body { flex: 1; min-width: 0; }
.up-name { font-weight: 700; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.up-state { color: var(--muted, #68736b); font-size: 11px; margin-top: 3px; }
.up-bar2 { height: 4px; border-radius: 99px; background: var(--line);
  margin-top: 6px; overflow: hidden; }
.up-bar2 i { display: block; height: 100%; width: 0; background: var(--ng-blue);
  border-radius: 99px; transition: width .5s ease; }
.up-spin { width: 16px; height: 16px; border: 2px solid rgba(23,20,193,.18);
  border-top-color: var(--ng-blue); border-radius: 50%;
  animation: upSpin .7s linear infinite; flex: 0 0 auto; }
@keyframes upSpin { to { transform: rotate(360deg); } }
.up-check { color: var(--ng-blue); font-weight: 800; font-size: 16px; }
.up-x { color: #9b2c1f; font-weight: 800; font-size: 16px; }


/* Leverans A: platt admin-meny + dold fillista */
.ad-nav.ad-flat > button { display: block; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 8px 10px; font: inherit;
  font-size: 12px; cursor: pointer; border-radius: 8px; color: inherit; }
.ad-nav.ad-flat > button:hover { background: rgba(23,20,193,.06); }
.ad-nav.ad-flat > button.on { background: rgba(23,20,193,.10); font-weight: 700; }
.file-list-wrap > summary { cursor: pointer; font-size: 12px; font-weight: 600;
  padding: 8px 0; color: var(--ng-blue); }

/* Helhet2: testresultat */
#webTestResult { margin: 8px 0; }



/* Fas 1: artifacts */
.artifact-box { margin: 10px 0; padding: 12px; border: 1px solid #e3e3ee;
  border-radius: 16px; background: #fff; }
.artifact-title { font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.artifact-box svg { max-width: 100%; height: auto; }
.kpi-row { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi-card { flex: 1; min-width: 110px; padding: 12px; border-radius: 12px;
  background: rgba(23,20,193,.06); text-align: center; }
.kpi-val { font-size: 18px; font-weight: 800; color: #1714C1; }
.kpi-label { font-size: 11px; color: #666; margin-top: 2px; }
.ps-head { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.ps-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.ps-sec { margin-top: 8px; } .ps-row { margin-left: 6px; }

/* ===== Fas 1 presentationskontrakt: tabellblock ===== */
.art-table-wrap { overflow-x: auto; margin-top: 6px; }
.art-table { border-collapse: collapse; font-size: 12px; width: 100%; }
.art-table th { text-align: left; font-weight: 600; padding: 5px 10px;
  border-bottom: 1px solid rgba(128,128,128,.35); }
.art-table td { padding: 5px 10px; border-bottom: 1px solid rgba(128,128,128,.15); }
.art-table tr:last-child td { border-bottom: none; }

/* Artifacts renderas i egen strip som överlever streamens ommålningar */
.artifact-strip { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

/* ===== v0.38.6: presentationsyta – full bredd, vänsterbaserad, animerad ===== */
.msg.assistant .body { max-width: 100%; flex: 1; align-items: stretch; }
.msg.assistant .box { width: 100%; }
.artifact-strip { width: 100%; }
.artifact-box { width: 100%; box-sizing: border-box; color: #14141c;
  animation: artIn .28s ease-out both; }
@keyframes artIn { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.artifact-box .artifact-title { font-size: 13px; color: #14141c; }
.chart-wrap { position: relative; width: 100%; height: 320px; }
.kpi-label { color: #55555f; }

/* ===== v0.38.7: artifacts följer färgtemat (tokens, inte hårdkodat) =====
   Grafer och kort renderas i temats färger. Byts temat till ljust behöver
   bara tokens ändras – JS läser dem vid varje rendering. */
:root {
  --art-bg: #1b1b24;            /* kortyta – följer panelmörkret */
  --art-bg-2: #22222d;
  --art-text: #eceaf4;
  --art-muted: #9a9aa6;
  --art-grid: rgba(255,255,255,.07);
  --art-line: rgba(255,255,255,.10);
  /* datapalett för mörk yta: accentfärgerna ur varumärket, ljus blå variant */
  --art-c1: #30BAFF; --art-c2: #CDFF09; --art-c3: #FA1E6F;
  --art-c4: #00A876; --art-c5: #8b89ff; --art-c6: #A0A4AD;
}
.artifact-box { background: linear-gradient(180deg, var(--art-bg-2), var(--art-bg));
  border: 1px solid var(--art-line); color: var(--art-text);
  box-shadow: 0 8px 28px rgba(0,0,0,.28);
  transition: transform .18s ease, box-shadow .18s ease; }
.artifact-box:hover { transform: translateY(-2px);
  box-shadow: 0 12px 34px rgba(0,0,0,.36); }
.artifact-box .artifact-title { color: var(--art-text); }
.artifact-box .art-table th { border-bottom-color: var(--art-line); color: var(--art-text); }
.artifact-box .art-table td { border-bottom-color: var(--art-grid); color: var(--art-text); }
.kpi-card { background: rgba(48,186,255,.08); }
.kpi-val { color: #CDFF09; }   /* Electric Lime – varumärkets signal för betoning */
.kpi-label { color: var(--art-muted); }

/* ===== v0.38.9: onboarding-portering (GUI-underlaget) i Northstar-tokens ===== */
.wiz-view label { display: block; margin-bottom: 10px; font-weight: var(--w-medium); }
.wiz-view input { display: block; width: 100%; margin-top: 3px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2);
  color: var(--text); padding: 8px 10px; font: 400 var(--fs-body) var(--font-body); outline: 0; }
.wiz-view input:focus { border-color: var(--ng-blue); }
.wiz-view .btn { width: 100%; margin-top: 4px; }
@keyframes wizFade { from { opacity: 0; transform: translateY(6px); } }
.wiz-view { animation: wizFade .28s ease; }
.wiz-stepper { display: flex; align-items: center; margin: 16px 0 12px; }
.wiz-dot { display: flex; flex-direction: column; align-items: center; gap: 5px; flex: 0 0 auto; }
.wiz-dot span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 12px; background: var(--panel-2); color: var(--steel);
  border: 2px solid var(--line); }
.wiz-dot em { font-size: 10px; color: var(--steel); font-style: normal; white-space: nowrap; }
.wiz-dot.active span { background: var(--ng-blue); color: #fff; border-color: var(--ng-blue);
  animation: wizPulse 1.8s ease-in-out infinite; }
.wiz-dot.active em { color: var(--text); font-weight: 700; }
.wiz-dot.done span { background: var(--electric-lime); color: var(--night);
  border-color: var(--electric-lime); }
.wiz-line { flex: 1 1 auto; height: 2px; background: var(--line); margin: 0 6px;
  position: relative; top: -8px; overflow: hidden; }
.wiz-line::after { content: ""; position: absolute; left: 0; top: 0; height: 100%; width: 0;
  background: var(--electric-lime); transition: width .4s ease; }
.wiz-line.filled::after { width: 100%; }
@keyframes wizPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(23,20,193,.5); }
  50% { box-shadow: 0 0 0 7px rgba(23,20,193,0); } }
@media (max-width: 760px) { .wiz-dot em { display: none; } }
/* matrix-bakgrunden ligger över gradientmolnet, under kortet */
.auth-bg canvas.matrix { position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: .5; mix-blend-mode: screen; }
@media (prefers-reduced-motion: reduce) { .auth-bg canvas.matrix { display: none; } }

/* ===== v0.38.10: device-code-flödet i underlagets språk ===== */
.dc-step { display: flex; align-items: center; gap: 8px; font-weight: var(--w-medium);
  margin: 12px 0 6px; }
.dc-num { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 11px;
  color: var(--steel); flex: none; }
.dc-coderow { display: flex; align-items: center; gap: 10px; margin: 4px 0 6px; }
.dc-coderow .wiz-code { flex: 1; margin: 0; }
.dc-coderow .btn { width: auto; margin: 0; padding: 8px 14px; }
.dc-wait { display: flex; align-items: center; gap: 8px; color: var(--steel);
  font-size: var(--fs-small); margin-top: 12px; }
.wiz-spin { width: 14px; height: 14px; border: 2px solid var(--line);
  border-top-color: var(--electric-lime); border-radius: 50%; flex: none;
  animation: wizSpin .8s linear infinite; }
@keyframes wizSpin { to { transform: rotate(360deg); } }

/* ===== v0.38.11: brett kort i setup-guiden + tydligare glyfregn ===== */
.auth-card.wide { width: min(720px, 94vw); min-height: 440px;
  padding: 34px 40px; border-radius: 24px;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #1d1d27, #15151d);
  transition: width .25s ease; }
.auth-card.wide #wizRoot { flex: 1; display: flex; flex-direction: column; }
.auth-card.wide .wiz-view { flex: 1; display: flex; flex-direction: column; }
.auth-card.wide .wiz-view .btn.primary:last-of-type { margin-top: auto; }
.wiz-points { display: flex; flex-direction: column; gap: 12px; margin: 18px 0 22px; }
.wiz-point { display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255,255,255,.02); }
.wiz-point .dot { width: 8px; height: 8px; border-radius: 50%; flex: none;
  margin-top: 4px; background: var(--electric-lime); }
.wiz-point strong { display: block; margin-bottom: 2px; }
.wiz-point span { color: var(--steel); line-height: 1.5; }
.auth-bg canvas.matrix { opacity: .68; }

/* ===== v0.38.12: riktig logotyp (statisk standard; admin-uppladdad vinner) ===== */
.brand-logo { height: 26px; width: auto; display: block; }
.sidebar .brand .brand-logo { height: 22px; margin: 0 0 2px 4px; }
.brand-logo ~ .brand-word { display: none; }  /* ordmärket visas bara om bilden saknas */

/* ===== v0.38.15: setup-vyn enligt Jens designfil (scopad .auth-view) ===== */
.auth-view { --ns-line: rgba(255,255,255,.08); --ns-line-strong: rgba(255,255,255,.13);
  --ns-blue: #3157ff; --ns-blue-d: #2443dc; --ns-blue-glow: rgba(49,87,255,.28);
  --ns-lime: #c8ff2f; --ns-lime-glow: rgba(200,255,47,.18);
  --ns-t100: #f7f9fb; --ns-t300: #c9ced8; --ns-t500: #8e96a3; --ns-t650: #68717f;
  display: block; overflow: hidden; letter-spacing: -.01em; color: var(--ns-t100);
  background:
    radial-gradient(circle at 78% 24%, rgba(37,78,255,.14), transparent 34%),
    radial-gradient(circle at 18% 90%, rgba(80,21,170,.10), transparent 30%),
    linear-gradient(180deg, #030405, #07090c); }
.auth-view .auth-bg { background: none; animation: none; overflow: hidden; }
.auth-view .auth-bg::after { background: none; }
.auth-view .auth-bg canvas.matrix { opacity: .52; z-index: 0;
  mask-image: linear-gradient(90deg, black 0%, black 23%, rgba(0,0,0,.38) 39%,
    rgba(0,0,0,.26) 50%, rgba(0,0,0,.38) 61%, black 77%, black 100%);
  -webkit-mask-image: linear-gradient(90deg, black 0%, black 23%, rgba(0,0,0,.38) 39%,
    rgba(0,0,0,.26) 50%, rgba(0,0,0,.38) 61%, black 77%, black 100%); }
.auth-view .ambient { position: absolute; inset: -15%; pointer-events: none; overflow: hidden; }
.auth-view .ambient::before, .auth-view .ambient::after { content: ""; position: absolute;
  width: 54vw; height: 54vw; border-radius: 50%; filter: blur(90px); opacity: .18;
  animation: nsdrift 16s ease-in-out infinite alternate; }
.auth-view .ambient::before { left: -8vw; top: 6vh; background: rgba(42,72,255,.42); }
.auth-view .ambient::after { right: -10vw; bottom: -18vh; background: rgba(76,24,180,.34);
  animation-duration: 21s; animation-direction: alternate-reverse; }
@keyframes nsdrift { from { transform: translate3d(0,0,0) scale(1); }
  to { transform: translate3d(7vw,4vh,0) scale(1.12); } }
.auth-view .scan-haze { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(80,110,255,.025) 46%,
    rgba(80,110,255,.07) 50%, rgba(80,110,255,.025) 54%, transparent 100%);
  transform: translateY(-110%); animation: nsscan 12s linear infinite; mix-blend-mode: screen; }
@keyframes nsscan { 0% { transform: translateY(-110%); } 100% { transform: translateY(110%); } }
.auth-view .shell { position: relative; z-index: 1; min-height: 100%;
  box-sizing: border-box;
  display: grid; grid-template-rows: auto 1fr auto; padding: 34px 44px 28px; }
.auth-view .topbar { display: flex; align-items: center; justify-content: space-between; }
.auth-view .brand { padding: 0; }
.auth-view .brand-logo { height: 30px; }
.auth-view .product-pill { display: inline-flex; align-items: center; gap: 8px; height: 34px;
  padding: 0 12px; border: 1px solid var(--ns-line); border-radius: 999px;
  background: rgba(255,255,255,.025); color: var(--ns-t500); font-size: 12px;
  backdrop-filter: blur(12px); }
.auth-view .product-pill .dot { width: 7px; height: 7px; border-radius: 50%;
  background: var(--ns-lime); box-shadow: 0 0 16px var(--ns-lime-glow); }
.auth-view .hero { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(520px,.95fr);
  gap: 88px; align-items: center; width: min(1280px,100%); margin: 0 auto; padding: 42px 0 34px; }
.auth-view .intro { max-width: 590px; padding-left: 10px; }
.auth-view .eyebrow { color: var(--ns-lime); font-size: 12px; font-weight: 750;
  letter-spacing: .16em; text-transform: uppercase; margin-bottom: 18px; }
.auth-view .hero-h1 { margin: 0; font: 780 clamp(42px,4.7vw,72px)/0.98 var(--font-head);
  letter-spacing: -.055em; max-width: 680px; }
.auth-view .hero-h1 span { color: var(--ns-t300); font-weight: 620; }
.auth-view .lead { margin: 24px 0 0; color: var(--ns-t500); font-size: 16px;
  line-height: 1.62; max-width: 530px; }
.auth-view .trust { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.auth-view .trust-chip { display: inline-flex; align-items: center; gap: 9px; padding: 9px 11px;
  border: 1px solid var(--ns-line); border-radius: 12px; background: rgba(255,255,255,.025);
  color: var(--ns-t300); font-size: 12px; }
.auth-view .trust-chip svg { opacity: .8; }
.auth-view .panel-wrap { position: relative; }
.auth-view .panel-wrap::before { content: ""; position: absolute; inset: 10% -10% -12% 12%;
  background: radial-gradient(circle, var(--ns-blue-glow), transparent 58%);
  filter: blur(34px); opacity: .5; pointer-events: none; }
.auth-view .panel.auth-card, .auth-view .panel.auth-card.wide { position: relative;
  width: auto; min-height: 0; padding: 0; overflow: hidden; display: block;
  border: 1px solid var(--ns-line-strong); border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,.025), transparent 28%), rgba(13,16,21,.94);
  box-shadow: 0 28px 90px rgba(0,0,0,.5); backdrop-filter: blur(20px); animation: none; }
.auth-view .panel.auth-card::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,.035), transparent 22%,
    transparent 72%, rgba(49,87,255,.045)); }
.auth-view .panel-head { display: block; padding: 26px 30px 18px;
  border-bottom: 1px solid var(--ns-line); }
.auth-view .panel-head h2 { white-space: normal; overflow: visible;
  text-overflow: clip; max-width: none; }
.auth-view .panel-title { margin: 0; font: 720 22px/1.2 var(--font-head); letter-spacing: -.03em; }
.auth-view .panel-sub { margin: 7px 0 0; color: var(--ns-t500); font-size: 13px; line-height: 1.5; }
.auth-view .panel-body { padding: 18px 30px 6px; position: relative; z-index: 1; }
.auth-view .auth-foot { padding: 0 30px 22px; margin: 10px 0 0; }
.auth-view .steps { padding: 2px 0 6px; }
.auth-view .step { position: relative; display: grid; grid-template-columns: 40px 1fr auto;
  gap: 14px; align-items: center; min-height: 82px; padding: 15px 14px;
  border-radius: 14px; transition: .22s ease; }
.auth-view .step + .step::before { content: ""; position: absolute; left: 34px; top: -11px;
  width: 1px; height: 22px; background: linear-gradient(var(--ns-line-strong), transparent); }
.auth-view .step:hover { background: rgba(255,255,255,.025); }
.auth-view .step-index { width: 34px; height: 34px; border-radius: 11px; display: grid;
  place-items: center; background: #171c24; border: 1px solid var(--ns-line);
  color: var(--ns-t500); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.auth-view .step:first-child .step-index { color: #030405; background: var(--ns-lime);
  border-color: var(--ns-lime); box-shadow: 0 0 22px var(--ns-lime-glow); }
.auth-view .step strong { display: block; color: var(--ns-t100); font-size: 13px;
  margin-bottom: 5px; font-weight: 700; }
.auth-view .step span { display: block; color: var(--ns-t500); font-size: 12px; line-height: 1.45; }
.auth-view .step-status { font-size: 11px; color: var(--ns-t650); padding-left: 10px; }
.auth-view .cta { width: 100%; height: 48px; border: 0; border-radius: 13px; color: #fff;
  background: linear-gradient(180deg, rgba(255,255,255,.09), transparent),
    linear-gradient(90deg, var(--ns-blue-d), var(--ns-blue));
  box-shadow: 0 12px 30px rgba(35,65,220,.28); font: 760 13px var(--font-body);
  cursor: pointer; transition: .2s ease; margin: 10px 0 4px; }
.auth-view .cta:hover { transform: translateY(-1px); filter: brightness(1.06);
  box-shadow: 0 16px 36px rgba(35,65,220,.34); }
.auth-view .support { margin: 10px 0 14px; display: flex; justify-content: space-between;
  gap: 12px; color: var(--ns-t650); font-size: 11px; }
.auth-view .support strong { color: var(--ns-t500); font-weight: 650; }
.auth-view .auth-footer { display: flex; justify-content: space-between; align-items: center;
  color: var(--ns-t650); font-size: 11px; }
.auth-view .auth-footer .secure { display: flex; align-items: center; gap: 8px; }
.auth-view .auth-footer .secure i { width: 6px; height: 6px; border-radius: 50%;
  background: var(--ns-lime); box-shadow: 0 0 12px var(--ns-lime-glow); }
@media (max-width: 980px) {
  .auth-view { overflow: auto; }
  .auth-view .shell { padding: 24px; }
  .auth-view .hero { grid-template-columns: 1fr; gap: 42px; padding: 60px 0; }
  .auth-view .intro { padding-left: 0; }
  .auth-view .panel-wrap { max-width: 620px; }
  .auth-view .auth-bg canvas.matrix { opacity: .15; } }
@media (max-width: 640px) {
  .auth-view .shell { padding: 20px 18px; }
  .auth-view .product-pill { display: none; }
  .auth-view .hero { padding: 42px 0 30px; }
  .auth-view .hero-h1 { font-size: 44px; }
  .auth-view .panel-head, .auth-view .panel-body { padding-left: 20px; padding-right: 20px; }
  .auth-view .step { grid-template-columns: 38px 1fr; }
  .auth-view .step-status { display: none; }
  .auth-view .auth-footer { gap: 16px; align-items: flex-start; flex-direction: column; } }

/* Låga skärmar: hellre scroll än onåbar CTA (tillägg till mockupens overflow-modell) */
@media (max-height: 760px) { .auth-view { overflow: auto; } }

/* ===== v0.38.19: förutsättningsbesked vid start + trygghetsrutor ===== */
.auth-view .prereq-card { margin: 4px 0 14px; padding: 14px 16px; border-radius: 14px;
  border: 1px solid rgba(250,30,111,.35); background: rgba(250,30,111,.07); }
.auth-view .prereq-head { font-weight: 750; color: #ff8fb4; margin-bottom: 6px; }
.auth-view .prereq-card p { margin: 0 0 8px; color: var(--ns-t300); line-height: 1.5; }
.auth-view .prereq-card code { background: rgba(255,255,255,.08); padding: 1px 6px;
  border-radius: 6px; }
.auth-view .prereq-card .btn { width: auto; margin: 2px 0 0; padding: 8px 14px; }
.auth-view .guided-help { margin: 14px 0 4px; padding: 13px 15px; border-radius: 14px;
  border: 1px solid var(--ns-line); background: rgba(255,255,255,.02);
  display: flex; flex-direction: column; gap: 6px; }
.auth-view .guided-help strong { font-size: 12px; color: var(--ns-t100); }
.auth-view .guided-help span { font-size: 12px; color: var(--ns-t500); line-height: 1.55;
  padding-left: 12px; position: relative; }
.auth-view .guided-help span::before { content: ""; position: absolute; left: 0; top: 7px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--ns-lime); }

/* ===== v0.38.21: skrivmaskins-onboarding ===== */
.auth-view .tw-caret::after { content: "▋"; color: var(--ns-lime);
  animation: twBlink 1s steps(1) infinite; margin-left: 1px; }
@keyframes twBlink { 50% { opacity: 0; } }
.auth-view .tw-on { min-height: 1em; }
/* Intro-overlay: läggs över panelkroppen, förklarar allt innan setup */
.auth-view .tw-intro { position: absolute; inset: 0; z-index: 5;
  background: linear-gradient(180deg, rgba(13,16,21,.98), rgba(10,12,17,.99));
  border-radius: 26px; display: flex; align-items: center;
  animation: twFade .3s ease; }
@keyframes twFade { from { opacity: 0; } }
.auth-view .tw-intro-inner { padding: 30px 32px; width: 100%; }
.auth-view .tw-intro-body p { margin: 0 0 14px; font-size: 13px; line-height: 1.65;
  color: var(--ns-t300); }
.auth-view .tw-intro-body b { color: var(--ns-t100); }
.auth-view .tw-intro .cta { margin-top: 8px; }
.auth-view .panel-wrap { position: relative; }

/* ===== v0.38.29: AI-val + Azure-aktiveringssteg ===== */
.auth-view .ai-choices { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.auth-view .ai-choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px;
  border: 1px solid var(--ns-line); border-radius: 14px; cursor: pointer;
  background: rgba(255,255,255,.02); }
.auth-view .ai-choice input { margin-top: 3px; }
.auth-view .ai-choice strong { display: block; color: var(--ns-t100); }
.auth-view .ai-choice span { color: var(--ns-t500); font-size: 12px; }
.auth-view .ai-tag { margin-left: 8px; font-size: 10px; color: var(--night);
  background: var(--ns-lime); padding: 1px 7px; border-radius: 999px; }
.auth-view .act-steps { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.auth-view .act-step { display: flex; align-items: center; gap: 10px; color: var(--ns-t500);
  font-size: 13px; }
.auth-view .act-step span { width: 24px; height: 24px; border-radius: 50%; display: grid;
  place-items: center; background: var(--ns-panel-2, #171c24); border: 1px solid var(--ns-line);
  font-size: 11px; flex: none; }
.auth-view .act-step.done span { background: var(--ns-lime); color: var(--night);
  border-color: var(--ns-lime); }
.auth-view .act-step.done { color: var(--ns-t100); }
.auth-view .act-step.load span { border-color: var(--ns-blue);
  animation: wizPulse 1.6s ease-in-out infinite; }
.auth-view .wiz-pick { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.auth-view .wiz-err { margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(250,30,111,.35); background: rgba(250,30,111,.07);
  color: #ff8fb4; font-size: 12px; }
