/* HeadquartersFN - kontrollpanelens utseende.
   En enda accentfärg (isblått "holografiskt" ljus), allt annat i blåsvart och gråskala.
   Grönt och rött används bara för vinst och förlust. */

:root {
  color-scheme: dark;
  --void: #04070a;
  --hull: #0a1219;
  --hull-2: #0e1821;
  --hull-3: #132029;
  --line: rgba(139, 233, 255, 0.10);
  --line-2: rgba(139, 233, 255, 0.20);
  --line-3: rgba(139, 233, 255, 0.38);
  --arc: #8be9ff;
  --arc-dim: rgba(139, 233, 255, 0.55);
  --arc-glow: rgba(139, 233, 255, 0.16);
  --ink: #e4f2f8;
  --ink-2: #b4c9d4;
  --mute: #7c95a3;
  --faint: #4d6370;
  --gain: #5fe3b0;
  --loss: #ff7a87;
  --gain-bg: rgba(95, 227, 176, 0.10);
  --loss-bg: rgba(255, 122, 135, 0.10);
  --display: "Michroma", "Eurostile", "Arial Narrow", sans-serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r: 6px;
  --r-lg: 10px;
  --rail: 232px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--void);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
body::before {
  /* svagt rutnät och ett kallt sken uppifrån, som en projektion */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(139, 233, 255, 0.07), transparent 60%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 64px 64px;
  mask-image: radial-gradient(ellipse at 60% 0%, #000 0%, rgba(0,0,0,.35) 45%, transparent 85%);
  opacity: .55;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(139, 233, 255, .25); }
:focus-visible { outline: 2px solid var(--arc); outline-offset: 2px; border-radius: 3px; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- skal */

.shell { position: relative; z-index: 1; display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px;
  padding: 26px 16px 20px; border-right: 1px solid var(--line); background: rgba(4, 7, 10, .72);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.bm-ring { fill: none; stroke: var(--arc-dim); stroke-width: 1.2; stroke-dasharray: 3 2.4; }
.bm-ring2 { fill: none; stroke: var(--arc); stroke-width: 1.6; }
.bm-core { fill: var(--arc); filter: drop-shadow(0 0 6px var(--arc)); }
.brand-text { font: 400 12.5px/1 var(--display); letter-spacing: .04em; color: var(--ink); }
.brand-text b { font-weight: 400; color: var(--arc); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r);
  color: var(--mute); font-size: 14.5px; transition: color .15s, background .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; }
.nav a:hover { color: var(--ink); background: rgba(139, 233, 255, .04); }
.nav a.active { color: var(--ink); background: rgba(139, 233, 255, .07); }
.nav a.active::before {
  content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 2px; background: var(--arc);
  box-shadow: 0 0 10px var(--arc);
}
.nav a.active svg { stroke: var(--arc); }
.nav .badge {
  margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 10px; font-size: 11.5px; font-weight: 600;
  text-align: center; background: var(--arc); color: var(--void);
}
.rail-foot { margin-top: auto; padding: 0 8px; display: grid; gap: 6px; }
.conn { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--mute); }
.conn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.conn.ok .dot { background: var(--arc); box-shadow: 0 0 8px var(--arc); }
.conn.bad .dot { background: var(--loss); }
.preview-note { font-size: 12px; line-height: 1.45; color: var(--ink-2); padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r); margin-bottom: 8px; }
.clock { font: 400 11px/1.4 var(--display); color: var(--faint); letter-spacing: .06em; }

.stage { min-width: 0; padding: 36px 44px 80px; outline: none; }
.page { max-width: 1320px; margin: 0 auto; container-type: inline-size; }

/* ---------------------------------------------------------------- typografi */

.h-page { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 0 0 26px; }
.h-page h1 { margin: 0; font: 400 26px/1.15 var(--display); letter-spacing: .01em; }
.h-page p { margin: 8px 0 0; color: var(--mute); max-width: 68ch; }
h2 { margin: 0; font: 600 15px/1.3 var(--sans); color: var(--ink); }
h3 { margin: 0; font: 500 14px/1.3 var(--sans); color: var(--ink-2); }
.muted { color: var(--mute); }
.faint { color: var(--faint); }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.arc { color: var(--arc); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .9em; }

/* ---------------------------------------------------------------- paneler */

.panel { position: relative; border: 1px solid var(--line); border-radius: var(--r-lg); background: rgba(10, 18, 25, .78); min-width: 0; }
.panel.hud::before, .panel.hud::after {
  /* hörnmarkeringar på de viktigaste panelerna */
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; border-color: var(--line-3); border-style: solid;
}
.panel.hud::before { top: -1px; left: -1px; border-width: 1px 0 0 1px; border-top-left-radius: var(--r-lg); }
.panel.hud::after { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; border-bottom-right-radius: var(--r-lg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head .sub { font-size: 13px; color: var(--mute); }
.panel-body { padding: 18px 20px; }
.panel-body.tight { padding: 8px 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2.even { grid-template-columns: 1fr 1fr; }
.stack { display: grid; gap: 18px; min-width: 0; }
.empty { padding: 34px 20px; text-align: center; color: var(--mute); font-size: 14px; }
.empty b { display: block; color: var(--ink-2); font-weight: 500; margin-bottom: 4px; }

/* ---------------------------------------------------------------- knappar och fält */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: transparent; color: var(--ink); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: border-color .15s, background .15s, color .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--line-3); background: rgba(139, 233, 255, .05); }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.btn.primary { background: var(--arc); border-color: var(--arc); color: var(--void); }
.btn.primary:hover { background: #a9f0ff; }
.btn.good { border-color: rgba(95, 227, 176, .45); color: var(--gain); }
.btn.good:hover { background: var(--gain-bg); }
.btn.bad { border-color: rgba(255, 122, 135, .4); color: var(--loss); }
.btn.bad:hover { background: var(--loss-bg); }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 8px; background: rgba(4, 7, 10, .6); }
.seg button { padding: 6px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--mute); font-size: 13px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--hull-3); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }

.field { display: grid; gap: 6px; }
.field label, .field .lbl { font-size: 13px; color: var(--mute); }
.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r); background: rgba(4, 7, 10, .7);
  color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--arc-dim); box-shadow: 0 0 0 3px var(--arc-glow); }
.input-kr { position: relative; }
.input-kr .input { padding-right: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.input-kr::after { content: "kr"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--mute); font-size: 13px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.switch input { appearance: none; width: 38px; height: 22px; border-radius: 11px; background: var(--hull-3); border: 1px solid var(--line-2); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--mute); transition: transform .2s var(--ease), background .2s; }
.switch input:checked { background: rgba(139, 233, 255, .2); border-color: var(--arc-dim); }
.switch input:checked::after { transform: translateX(16px); background: var(--arc); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 20px; border: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.chip.arc { border-color: var(--arc-dim); color: var(--arc); }
.chip.gain { border-color: rgba(95, 227, 176, .4); color: var(--gain); }
.chip.loss { border-color: rgba(255, 122, 135, .4); color: var(--loss); }
.chip.dim { color: var(--mute); border-color: var(--line); }
.chip.warn { color: var(--arc); border-color: var(--line-3); border-style: dashed; }
.chip.solid { background: var(--arc); color: var(--void); border-color: var(--arc); font-weight: 600; }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.on { background: var(--arc); box-shadow: 0 0 8px var(--arc); }
.dot.warn { background: var(--loss); }

/* ---------------------------------------------------------------- tabeller */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--mute); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(139, 233, 255, .035); }
td.r, th.r { text-align: right; }

/* ---------------------------------------------------------------- små diagram */

.spark { display: block; overflow: visible; }
.spark path.l { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark path.a { stroke: none; }
.spark.up path.l { stroke: var(--gain); }
.spark.down path.l { stroke: var(--loss); }
.spark.flat path.l { stroke: var(--mute); }
.spark.up path.a { fill: rgba(95, 227, 176, .08); }
.spark.down path.a { fill: rgba(255, 122, 135, .07); }
.spark.flat path.a { fill: none; }
.bar-track { height: 4px; background: var(--hull-3); border-radius: 2px; overflow: hidden; }
.bar-track span { display: block; height: 100%; background: var(--arc); border-radius: 2px; }

/* ---------------------------------------------------------------- startsidan */

.hero { display: grid; grid-template-columns: minmax(300px, 460px) 1fr; gap: 56px; align-items: center; margin: 4px 0 40px; }
.reactor { position: relative; width: 100%; aspect-ratio: 1; }
.reactor svg { width: 100%; height: 100%; overflow: visible; }
.r-tick { stroke: var(--line-2); stroke-width: 1; }
.r-tick.major { stroke: var(--line-3); }
.r-spin { transform-origin: 200px 200px; animation: spin 90s linear infinite; }
.r-spin.rev { animation-duration: 140s; animation-direction: reverse; }
.r-ring { fill: none; stroke: var(--line-2); stroke-width: 1; }
.r-ring.dash { stroke-dasharray: 2 6; stroke: var(--line-3); }
.r-seg { fill: none; stroke-width: 15; stroke-linecap: butt; cursor: pointer; transition: stroke .3s, opacity .3s, filter .3s; stroke: rgba(139, 233, 255, .10); }
.r-seg.run { stroke: rgba(139, 233, 255, .34); }
.r-seg.strat { stroke: var(--arc); filter: drop-shadow(0 0 6px rgba(139, 233, 255, .6)); }
.r-seg.want { stroke: #ffffff; filter: drop-shadow(0 0 8px rgba(255, 255, 255, .7)); animation: pulse 2.2s ease-in-out infinite; }
.r-seg:hover, .r-seg:focus-visible { stroke-width: 19; outline: none; }
.r-label { font: 400 9px var(--display); fill: var(--mute); letter-spacing: .12em; }
.r-core { fill: url(#coreGlow); }
.r-center-num { font: 400 46px var(--display); fill: var(--ink); }
.r-center-sub { font: 400 12px var(--sans); fill: var(--mute); }
.reactor .r-tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -120%); padding: 6px 10px; border-radius: var(--r);
  background: var(--hull-2); border: 1px solid var(--line-2); font-size: 12.5px; white-space: nowrap; color: var(--ink);
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .55; } }

.hero-text .greet { margin: 0; font-size: 17px; color: var(--mute); }
.hero-text { container-type: inline-size; min-width: 0; }
.wordmark { margin: 10px 0 18px; font: 400 clamp(24px, 8.6cqi, 64px)/1 var(--display); letter-spacing: .02em; color: var(--ink); white-space: nowrap; }
.wordmark span { color: var(--arc); text-shadow: 0 0 28px rgba(139, 233, 255, .45); }
.hero-text .brief { margin: 0; max-width: 46ch; font-size: 17px; line-height: 1.6; color: var(--ink-2); }
.hero-text .brief b { color: var(--ink); font-weight: 500; }
.hero-actions { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.exchanges { display: flex; gap: 22px; margin-top: 28px; flex-wrap: wrap; font-size: 13px; color: var(--mute); }
.exchanges span { display: inline-flex; align-items: center; gap: 8px; }

.facts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 18px; }
.fact { padding: 18px 20px; border-left: 1px solid var(--line); min-width: 0; }
.fact:first-child { border-left: 0; }
.fact .k { font-size: 13px; color: var(--mute); }
.fact .v { margin-top: 6px; font: 500 22px/1.15 var(--sans); letter-spacing: -.01em; white-space: nowrap; }
.fact .s { margin-top: 3px; font-size: 12.5px; color: var(--mute); }

.tickers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 18px; overflow: hidden; }
.ticker { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 14px 18px; border-left: 1px solid var(--line); cursor: pointer; }
.ticker:first-child { border-left: 0; }
.ticker:hover { background: rgba(139, 233, 255, .03); }
.ticker .n { font-size: 13px; color: var(--mute); }
.ticker .p { font-weight: 500; }
.ticker .c { text-align: right; font-size: 13px; white-space: nowrap; }
.ticker svg { grid-column: 1 / -1; margin-top: 6px; width: 100%; }
.ticker .p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent svg.spark { width: 100%; }

.news { display: grid; }
.news a { display: grid; grid-template-columns: 64px 1fr; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.news a:last-child { border-bottom: 0; }
.news a:hover { background: rgba(139, 233, 255, .03); }
.news a:hover .t { color: var(--arc); }
.news .img { width: 64px; height: 48px; border-radius: 4px; background: var(--hull-3) center / cover no-repeat; border: 1px solid var(--line); }
.news .t, .news .m { display: block; }
.news .t { font-size: 14.5px; line-height: 1.4; color: var(--ink); transition: color .15s; }
.news .m { margin-top: 4px; font-size: 12.5px; color: var(--mute); }

.feed { display: grid; }
.feed-item { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-item .who { font-size: 13px; font-weight: 600; color: var(--ink); }
.feed-item .txt { font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.feed-item .when { font-size: 12px; color: var(--faint); margin-top: 3px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font: 400 9.5px var(--display); letter-spacing: .02em; color: var(--arc); border: 1px solid var(--line-3);
  background: radial-gradient(circle at 50% 35%, rgba(139, 233, 255, .14), transparent 70%);
}
.avatar.krypto { color: var(--ink); border-color: var(--line-2); background: radial-gradient(circle at 50% 35%, rgba(228, 242, 248, .10), transparent 70%); }
.avatar.you { color: var(--void); background: var(--ink); border-color: var(--ink); }
.avatar.hq { color: var(--void); background: var(--arc); border-color: var(--arc); }

/* ---------------------------------------------------------------- agenter */

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.group-title { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 14px; }
.group-title h2 { font: 400 14px/1 var(--display); letter-spacing: .03em; }
.group-title .muted { font-size: 13px; }
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.agent {
  position: relative; display: grid; gap: 12px; padding: 16px 16px 14px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: rgba(10, 18, 25, .78); transition: border-color .2s, background .2s;
}
.agent:hover { border-color: var(--line-3); background: rgba(14, 24, 33, .9); }
.agent.has-want { border-color: rgba(255, 255, 255, .35); }
.agent .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.agent .lbl { font-weight: 600; font-size: 14.5px; line-height: 1.3; word-break: break-word; }
.agent .sym { font-size: 12.5px; color: var(--mute); margin-top: 2px; }
.agent .px { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.agent .px b { font-size: 19px; font-weight: 500; }
.agent .px span { font-size: 13px; }
.agent .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--mute); min-height: 22px; }
.agent .strat { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent .strat.none { color: var(--mute); }
.agent .act { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.detail-head { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; margin-bottom: 22px; }
.detail-head .avatar { width: 52px; height: 52px; font-size: 13px; }
.detail-head h1 { margin: 0; font: 400 22px/1.2 var(--display); }
.detail-head .sub { color: var(--mute); margin-top: 6px; font-size: 14px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.quote-big { text-align: right; }
.quote-big b { display: block; font: 500 28px/1.1 var(--sans); letter-spacing: -.01em; }
.quote-big span { font-size: 14px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--mute); font-size: 13.5px; margin-bottom: 16px; }
.back:hover { color: var(--arc); }
.back svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.chart-box { position: relative; height: 440px; }
.chart-box .msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mute); font-size: 14px; pointer-events: none; }
.chart-foot { display: flex; justify-content: space-between; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--mute); flex-wrap: wrap; }
.ohlc { display: flex; gap: 14px; flex-wrap: wrap; }
.ohlc b { color: var(--ink-2); font-weight: 500; }
.legend-lines { display: flex; gap: 14px; flex-wrap: wrap; }
.legend-lines i { display: inline-block; width: 14px; height: 0; border-top: 2px dashed; vertical-align: middle; margin-right: 6px; }

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--mute); }
.kv .v { text-align: right; }
.rules { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
.rules li { display: grid; grid-template-columns: 14px 1fr; gap: 8px; }
.rules li::before { content: ""; width: 6px; height: 6px; margin-top: 8px; border: 1px solid var(--arc-dim); transform: rotate(45deg); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.split .cell { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); }
.split .cell .k { font-size: 12.5px; color: var(--mute); }
.split .cell .v { font-size: 18px; font-weight: 500; margin-top: 2px; }
.split .cell .s { font-size: 12.5px; color: var(--mute); }

.log { max-height: 280px; overflow: auto; padding: 10px 20px; font: 12.5px/1.65 var(--mono); color: var(--mute); }
.log .WARNING, .log .ERROR { color: var(--loss); }
.log .t { color: var(--faint); margin-right: 10px; }

/* ---------------------------------------------------------------- kommunikation */

.comms { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.channel { display: grid; }
.msg-row { display: grid; grid-template-columns: 32px 1fr; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.msg-row:last-child { border-bottom: 0; }
.msg-row.fresh { animation: arrive .9s var(--ease); }
@keyframes arrive { from { background: rgba(139, 233, 255, .08); } to { background: transparent; } }
.msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.msg-head .who { font-weight: 600; color: var(--ink); }
.msg-head .to { color: var(--mute); }
.msg-head .when { margin-left: auto; font: 12px var(--mono); color: var(--faint); }
.msg-text { margin-top: 5px; font-size: 14.5px; line-height: 1.55; color: var(--ink-2); max-width: 78ch; }
.kind { font-size: 11.5px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line-2); color: var(--mute); }
.kind.strategi, .kind.lärde { border-color: var(--arc-dim); color: var(--arc); }
.kind.affär.win { border-color: rgba(95, 227, 176, .4); color: var(--gain); }
.kind.affär.lose, .kind.varning { border-color: rgba(255, 122, 135, .4); color: var(--loss); }
.kind.köp { border-color: rgba(255, 255, 255, .35); color: var(--ink); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters .seg { flex-wrap: wrap; }
.know { display: grid; }
.know-item { padding: 14px 20px; border-bottom: 1px solid var(--line); }
.know-item:last-child { border-bottom: 0; }
.know-item .nm { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.know-item .nm b { font-weight: 600; font-size: 14.5px; }
.know-item .by { font-size: 12.5px; color: var(--mute); margin-top: 3px; }
.know-item .users { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.web { width: 100%; height: auto; display: block; }
.web .node circle { fill: var(--hull-2); stroke: var(--line-3); stroke-width: 1; }
.web .node.strat circle { stroke: var(--arc); fill: rgba(139, 233, 255, .12); }
.web .node text { font: 400 7.5px var(--display); fill: var(--mute); }
.web .edge { stroke: var(--arc); stroke-opacity: .45; stroke-width: 1.2; fill: none; }
.web .edge.share { stroke-dasharray: 3 4; stroke-opacity: .25; }

/* ---------------------------------------------------------------- handel */

.proposals { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.proposal { display: grid; gap: 14px; padding: 18px; border: 1px solid rgba(255, 255, 255, .22); border-radius: var(--r-lg); background: rgba(14, 24, 33, .9); }
.proposal .top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.proposal .lbl { font-weight: 600; }
.proposal .why { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; }
.levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.levels div { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r); }
.levels .k { font-size: 11.5px; color: var(--mute); }
.levels .v { font-size: 14px; font-weight: 500; margin-top: 1px; }
.proposal .actions { display: flex; gap: 10px; }
.proposal .actions .btn { flex: 1; }
.kpis { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(4, minmax(0, 1fr)); }
.kpis .fact .v.big { font-size: 30px; }

/* ---------------------------------------------------------------- chatt */

.chat { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: calc(100vh - 170px); min-height: 520px; }
.chat-list { border-right: 1px solid var(--line); overflow-y: auto; padding: 8px; }
.chat-list button {
  width: 100%; display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: center; padding: 9px 10px; border: 0;
  border-radius: var(--r); background: transparent; text-align: left; cursor: pointer; color: var(--ink-2);
}
.chat-list button:hover { background: rgba(139, 233, 255, .04); }
.chat-list button.on { background: rgba(139, 233, 255, .08); color: var(--ink); }
.chat-list .nm, .chat-list .st { display: block; }
.chat-list button > span:nth-child(2) { min-width: 0; }
.chat-list .nm { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list .st { font-size: 12px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list .sep { padding: 14px 10px 6px; font-size: 12px; color: var(--faint); }
.thread-wrap { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.thread-head .s { font-size: 13px; color: var(--mute); }
.thread { overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.bubble { max-width: min(640px, 82%); padding: 11px 15px; border-radius: 14px; font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: var(--ink); color: var(--void); border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: var(--hull-2); border: 1px solid var(--line-2); border-bottom-left-radius: 4px; }
.bubble .by { display: block; font-size: 12px; color: var(--arc); margin-bottom: 3px; font-weight: 500; }
.bubble .tm { display: block; font-size: 11px; margin-top: 5px; opacity: .55; }
.bubble.typing { color: var(--mute); }
.typing i { display: inline-block; width: 5px; height: 5px; margin: 0 2px; border-radius: 50%; background: var(--mute); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }
.composer { border-top: 1px solid var(--line); padding: 14px 20px 18px; display: grid; gap: 10px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; }
.suggest button { padding: 5px 11px; border-radius: 16px; border: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.suggest button:hover { border-color: var(--arc-dim); color: var(--arc); }
.compose-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.compose-row textarea { resize: none; min-height: 46px; max-height: 140px; }

/* ---------------------------------------------------------------- marknader */

.mkt-name { display: flex; align-items: center; gap: 10px; }
.mkt-name .tag { font-size: 11px; color: var(--arc); border: 1px solid var(--arc-dim); padding: 0 6px; border-radius: 8px; }
.mkt-name small { display: block; font-size: 12px; color: var(--mute); }
.chg-bar { display: inline-flex; align-items: center; gap: 10px; justify-content: flex-end; min-width: 140px; }
.chg-bar .bar { width: 60px; height: 4px; background: var(--hull-3); border-radius: 2px; position: relative; }
.chg-bar .bar span { position: absolute; top: 0; bottom: 0; border-radius: 2px; }
.drawer { margin-bottom: 18px; }

/* ---------------------------------------------------------------- demopengar */

.alloc { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.alerts-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.al-form { display: grid; gap: 14px; }
.gl-goal { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: center; }
.gl-num { font: 400 30px/1.2 var(--display); margin: 4px 0 10px; }
.gl-bar { height: 8px; border-radius: 4px; background: var(--hull-3); overflow: hidden; margin-bottom: 6px; }
.gl-bar span { display: block; height: 100%; background: var(--arc); box-shadow: 0 0 12px var(--arc-glow); }
.gl-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gl-kpis div { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); }
.gl-kpis b { font: 500 20px/1.2 var(--sans); }
.gl-kpis span, .gl-step span { font-size: 12.5px; color: var(--mute); }
.gl-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.gl-step { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--hull); }
.gl-step b { font: 500 20px/1.2 var(--sans); }
.gl-step small { color: var(--mute); font-weight: 400; font-size: 13px; }
.gl-table td.gl-tick, .gl-table th.gl-tick { text-align: center; padding-left: 6px; padding-right: 6px; }
.gl-tick { color: var(--faint); }
.gl-tick.ok { color: var(--arc); }
.gl-tick svg { width: 16px; height: 16px; vertical-align: middle; stroke: currentColor; fill: none; stroke-width: 2.4; }
.gl-tick.ok { filter: drop-shadow(0 0 4px var(--arc-glow)); }
.gl-table tbody tr:hover td { background: var(--hull-2); }
.fn { display: grid; gap: 8px; }
.fn-row { display: grid; grid-template-columns: minmax(120px, 210px) minmax(0, 1fr) 44px; gap: 12px; align-items: center; font-size: 13.5px; }
.fn-label { color: var(--ink-2); }
.fn-bar { height: 10px; border-radius: 5px; background: var(--hull-3); overflow: hidden; }
.fn-bar span { display: block; height: 100%; background: var(--arc-dim); }
.fn-last .fn-bar span { background: var(--arc); box-shadow: 0 0 10px var(--arc-glow); }
.fn-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.al-rules { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13.5px; color: var(--ink-2); }
.total-row { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: end; }
.total-row .big-input { font: 500 30px/1.2 var(--sans); padding: 10px 50px 10px 14px; }
.total-row .input-kr::after { font-size: 16px; }
.alloc-rows { display: grid; }
.alloc-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(120px, 2fr) 140px minmax(90px, .8fr); gap: 16px; align-items: center; padding: 11px 20px; border-bottom: 1px solid var(--line); }
.alloc-row:last-child { border-bottom: 0; }
.alloc-row .nm { font-weight: 500; font-size: 14px; }
.alloc-row .nm small { display: block; color: var(--mute); font-weight: 400; font-size: 12px; }
.alloc-row .now { text-align: right; font-size: 13px; color: var(--mute); }
.alloc-row input[type=range] { width: 100%; accent-color: var(--arc); }
.alloc-sum { display: flex; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line-2); font-size: 14px; flex-wrap: wrap; }
.alloc-sum.off b { color: var(--loss); }

/* ---------------------------------------------------------------- dialog och notiser */

.toasts { position: fixed; right: 22px; bottom: 22px; display: grid; gap: 10px; z-index: 50; }
.toast { padding: 12px 16px; border-radius: var(--r); background: var(--hull-2); border: 1px solid var(--line-3); box-shadow: 0 12px 40px rgba(0, 0, 0, .5); font-size: 14px; max-width: 380px; animation: rise .3s var(--ease); }
.toast.err { border-color: rgba(255, 122, 135, .5); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
dialog { border: 1px solid var(--line-3); border-radius: var(--r-lg); background: var(--hull); color: var(--ink); padding: 24px; max-width: 420px; }
dialog::backdrop { background: rgba(2, 4, 6, .7); backdrop-filter: blur(3px); }
dialog h2 { margin-bottom: 8px; }
dialog p { color: var(--ink-2); margin: 0 0 20px; }
dialog .row { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------------------------------------------------------------- tursäkerhet */

.luck { display: grid; gap: 5px; padding-top: 2px; }
.luck-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--mute); }
.luck-row b { font-weight: 500; color: var(--ink-2); }
.luck-sub { font-size: 11.5px; color: var(--faint); }
.reqs { display: grid; gap: 12px; }
.req { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); display: grid; gap: 6px; }
.req.ok { border-color: rgba(95, 227, 176, .35); }
.req-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.req-top span { color: var(--ink-2); }
.req.ok .req-top span { color: var(--gain); }
.req-need { font-size: 12px; color: var(--mute); }

/* ---------------------------------------------------------------- gästläge (allt utom köp, sälj och uttag) */

body.guest [data-act="approve"], body.guest .dm-reset, body.guest .dm-approve { display: none !important; }

/* ---------------------------------------------------------------- mobil */

@container (max-width: 1080px) {
  .hero { grid-template-columns: minmax(240px, 340px) 1fr; gap: 36px; }
  .facts { grid-template-columns: repeat(3, 1fr); }
  .facts .fact:nth-child(4) { border-left: 0; }
  .facts .fact:nth-child(n+4) { border-top: 1px solid var(--line); }
  .tickers { grid-template-columns: repeat(3, 1fr); }
  .tickers .ticker:nth-child(4) { border-left: 0; }
  .tickers .ticker:nth-child(n+4) { border-top: 1px solid var(--line); }
  .grid-2, .grid-2.even, .comms, .alloc, .alerts-grid, .gl-goal { grid-template-columns: 1fr; }
  .gl-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpis .fact:nth-child(4) { border-left: 0; }
  .kpis .fact:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@container (max-width: 720px) {
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .reactor { max-width: 320px; margin: 0 auto; }
  .facts, .tickers, .kpis { grid-template-columns: 1fr 1fr; }
  .facts .fact, .tickers .ticker, .kpis .fact { border-left: 0 !important; border-top: 1px solid var(--line); }
  .facts .fact:nth-child(-n+2), .tickers .ticker:nth-child(-n+2), .kpis .fact:nth-child(-n+2) { border-top: 0; }
  .facts .fact:nth-child(even), .tickers .ticker:nth-child(even), .kpis .fact:nth-child(even) { border-left: 1px solid var(--line) !important; }
  .detail-head { grid-template-columns: auto 1fr; }
  .quote-big { grid-column: 1 / -1; text-align: left; }
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-list { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); gap: 4px; }
  .chat-list button { width: auto; grid-template-columns: 28px auto; flex: none; }
  .chat-list button .st, .chat-list button .dot, .chat-list .sep { display: none; }
  .thread { min-height: 50vh; }
  .alloc-row { grid-template-columns: 1fr 130px; }
  .alloc-row input[type=range], .alloc-row .now, .alloc-row .bar-track { display: none; }
  .levels { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 20; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line); gap: 0;
  }
  .brand, .rail-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-between; }
  .nav a { flex-direction: column; gap: 3px; padding: 7px 2px; font-size: 10px; flex: 1; text-align: center; min-width: 0; }
  .nav a span:not(.badge) { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .nav a.active::before { left: 25%; right: 25%; top: -6px; bottom: auto; width: auto; height: 2px; }
  .nav .badge { position: absolute; top: 2px; right: 12%; margin: 0; font-size: 10px; padding: 0 5px; min-width: 16px; }
  .stage { padding: 22px 16px 110px; }
  .chart-box { height: 340px; }
  .toasts { bottom: 90px; left: 16px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- märken på agentkorten */

.agent .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.agent .chips .chip { font-size: 11.5px; padding: 2px 8px; }
