/* Nordic clean UI - dark (default) & light themes via CSS variables. */

:root, [data-theme="dark"] {
  /* Native controls (calendar icon, select arrows, scrollbars) follow the theme */
  color-scheme: dark;
  --bg: #0b0e13;
  --panel: #0f131a;
  --card: #171c26;
  --border: #232936;
  --text: #eaedf2;
  --muted: #868f9f;
  --accent: #eaedf2;
  --green: #34c98e;
  --red: #e5646e;
  --blue: #5aa9e6;
  --amber: #dfa63f;
  --chip-bg: #171c26;
  --tag-bg: rgba(138, 147, 165, 0.14);
  /* Flat UI: effects deliberately disabled — no shadows, gradients or glow */
  --shadow: none;
  --sheen: transparent;
  --card-strong-border: transparent;
  --glow: transparent;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --card: #ffffff;
  --border: #e4e7ec;
  --text: #1d2430;
  --muted: #687182;
  --accent: #1d2430;
  --green: #1d9d6f;
  --red: #d4444f;
  --blue: #2f7fc4;
  --amber: #a8700d;
  --chip-bg: #eef0f3;
  --tag-bg: rgba(104, 113, 130, 0.12);
  --shadow: none;
  --sheen: transparent;
  --card-strong-border: transparent;
  --glow: transparent;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

:root { --sidebar-w: 232px; --ctrl-h: 34px; --ctrl-r: 8px; }
/* Collapsed width = sidebar padding (12+12) + item padding (12+12) + icon (20)
   so the icon sits at the exact same x in both states — nothing shifts. */
html[data-collapsed="true"] { --sidebar-w: 68px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  letter-spacing: 0.01em;
  margin-left: var(--sidebar-w);
  transition: margin-left 0.18s ease;
}

/* ---------------- Collapsible left sidebar ---------------- */
.sidebar {
  position: fixed; left: 0; top: 0; height: 100vh; width: var(--sidebar-w);
  background: var(--panel);
  display: flex; flex-direction: column; gap: 6px; padding: 16px 12px;
  overflow: hidden; z-index: 50; transition: width 0.18s ease;
}
.nav-text { transition: opacity 0.15s ease; }
html[data-collapsed="true"] .nav-text { opacity: 0; width: 0; overflow: hidden; }
/* The toggle IS a nav-link row (class="nav-link sidebar-toggle") — identical
   left edge and hover; this rule only resets the <button> element defaults. */
.sidebar-toggle { background: none; border: none; cursor: pointer; font: inherit; width: 100%; margin-bottom: 10px; }
/* Top row: collapse toggle left + Paper on/off switch right (user decision
   13/7 — a classic toggle replaced the two-icon switch; ON = Paper mode).
   Flat like everything else: fill colors only, no borders/shadows. */
/* -3px cancels all but 3px of the sidebar's 6px flex gap, so the toggle sits the
   same 3px (→ 25px incl. padding) above the first nav item as nav items are apart. */
.sidebar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: -3px; }
.sidebar-top .sidebar-toggle { width: auto; margin-bottom: 0; }
.mode-toggle {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 4px 0 0;
  background: none; border: none; cursor: pointer;
  font: inherit; font-size: 0.78rem; color: var(--muted);
  transition: color 0.12s ease;
}
.mode-toggle:hover { color: var(--text); }
.mode-track {
  position: relative; flex-shrink: 0; width: 34px; height: 20px;
  border-radius: 999px; background: var(--chip-bg);
  transition: background 0.15s ease;
}
.mode-knob {
  position: absolute; top: 3px; left: 3px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--muted);
  transition: left 0.15s ease, background 0.15s ease;
}
.mode-toggle.on .mode-track { background: rgba(230, 160, 60, 0.28); }
.mode-toggle.on .mode-knob { left: 17px; background: #d9962e; }
.mode-toggle.on .mode-label { color: #d9962e; }
/* Canonical on/off switch for a SIMPLE true/false option (user convention 16/7:
   a boolean is ALWAYS a sliding toggle, never a two-button/segmented control).
   Flat: fill colors only, no border/shadow. Built via makeSwitch() in common.js. */
.switch { position: relative; display: inline-flex; align-items: center;
  flex-shrink: 0; width: 40px; height: 22px; cursor: pointer; }
/* Neutralise the global custom-checkbox styling (same specificity would lose to
   it by source order) so only the track + knob show. */
.switch input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  position: absolute; margin: 0; width: 0; height: 0; opacity: 0;
}
.switch-track { width: 100%; height: 100%; border-radius: 999px;
  background: var(--chip-bg); transition: background 0.15s ease; }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--muted);
  transition: left 0.15s ease, background 0.15s ease; }
.switch input:checked ~ .switch-track { background: color-mix(in srgb, var(--text) 26%, var(--chip-bg)); }
.switch input:checked ~ .switch-knob { left: 21px; background: var(--text); }
html[data-collapsed="true"] .sidebar-top { flex-direction: column; align-items: stretch; gap: 6px; }
html[data-collapsed="true"] .mode-toggle { justify-content: center; gap: 0; padding: 0; }
.sidebar svg { width: 20px; height: 20px; }
/* The nav is the scrollable middle when the menu outgrows the viewport —
   no visible scrollbar; the toggle (top) and Settings/theme (bottom) stay put. */
/* Middle scroller: nav links + the kill/Settings actions. It takes the flexible
   height and scrolls (no visible scrollbar) when the viewport is too short —
   the toggle (top) and user block (bottom) stay sticky outside it. */
.sidebar-scroll {
  flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none;
  display: flex; flex-direction: column;
}
.sidebar-scroll::-webkit-scrollbar { display: none; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
/* Kill switch + Settings sit at the bottom of the scroll area (pushed down when
   there is room; scroll into view with the nav when there isn't). */
.sidebar-actions { margin-top: auto; display: flex; flex-direction: column; gap: 3px; }
.sidebar-top, .sidebar-bottom { flex-shrink: 0; }
/* Leave 3px of the sidebar's 6px flex gap above the user block → same 25px
   rhythm (incl. padding) as everywhere else in the sidebar. */
.sidebar-bottom { margin-top: -3px; }
.nav-link {
  display: flex; align-items: center; gap: 13px; padding: 11px 12px;
  border-radius: 11px; color: var(--muted); text-decoration: none;
  font-size: 0.92rem; white-space: nowrap; transition: background 0.12s ease, color 0.12s ease;
}
.nav-link svg { flex-shrink: 0; }
.nav-link:hover { color: var(--text); background: var(--card); }
.nav-link.active { color: var(--text); background: var(--card); font-weight: 600; }
html[data-collapsed="true"] .nav-link { padding: 11px 12px; gap: 0; }
/* Grouped nav (parent + indented sub-links with a vertical guide line). */
.nav-group.open { color: var(--text); }
/* Sub-links: the hover/active pill spans the FULL sidebar width exactly like
   the main items (user decision 11/7); only the text is indented, and the
   vertical guide line is drawn underneath via ::before. */
.nav-subs {
  display: flex; flex-direction: column; gap: 2px;
  margin: 2px 0 4px; position: relative;
}
.nav-subs::before {
  content: ""; position: absolute; left: 22px; top: 2px; bottom: 2px;
  width: 2px; background: var(--border);
}
.nav-sub {
  display: block; padding: 9px 12px 9px 45px; border-radius: 11px;
  position: relative; z-index: 1;
  color: var(--muted); text-decoration: none; font-size: 0.9rem;
  white-space: nowrap; transition: background 0.12s ease, color 0.12s ease;
}
/* Per-item segment of the guide line ON TOP of the pill, so the line stays
   unbroken across hovered/active items too */
.nav-sub::before {
  content: ""; position: absolute; left: 22px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.nav-sub:hover { color: var(--text); background: var(--card); }
.nav-sub.active { color: var(--text); background: var(--card); font-weight: 600; }
/* Collapsible submenu (Settings): closed until the parent is clicked */
.nav-subs.collapsible { display: none; }
.nav-subs.collapsible.open { display: flex; }
html[data-collapsed="true"] .nav-subs,
html[data-collapsed="true"] .nav-subs.collapsible.open { display: none; }
@media (max-width: 720px) { .nav-subs, .nav-subs.collapsible.open { display: none; } }
.sidebar-actions .nav-link { width: 100%; background: none; border: none; cursor: pointer; font: inherit; font-size: 0.92rem; }
/* The reset above outranks the shared .nav-link:hover — restate it */
.sidebar-actions .nav-link:hover { color: var(--text); background: var(--card); }
/* Signed-in user block: avatar placeholder + name + log-out icon on the right. */
/* Same padding (11/12) + gap (13) as .nav-link so the name's left edge lands on
   the 45px text axis and the row height (→ spacing) matches the menu items. */
.sidebar-user {
  display: flex; align-items: center; gap: 13px; padding: 11px 12px; border-radius: 11px;
}
/* Larger than the 20px icons, but its LAYOUT footprint stays 20px via symmetric
   -5px margins — so it renders centered on the icon axis (22px) without pushing
   the name off the text axis or making the row taller. */
.sidebar-avatar {
  flex-shrink: 0; width: 30px; height: 30px; margin: -5px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--chip-bg); color: var(--muted);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.01em;
  object-fit: cover; overflow: hidden;
}
.sidebar-username {
  flex: 1; min-width: 0; color: var(--muted); font-weight: 400; font-size: 0.9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-logout {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--muted); border-radius: 8px; transition: color 0.12s ease;
}
.sidebar-logout:hover { color: var(--text); }
/* Collapsed rail: name + log-out are gone, so drop the 20px-footprint trick and
   center the full 30px avatar in the same content box as the nav-link icons —
   both land on the rail's icon axis. */
html[data-collapsed="true"] .sidebar-user { justify-content: center; padding: 11px 12px; gap: 0; }
html[data-collapsed="true"] .sidebar-avatar { margin: 0; }
html[data-collapsed="true"] .sidebar-username,
html[data-collapsed="true"] .sidebar-logout { display: none; }
.nav-ic { width: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.page-title { font-size: 1.18rem; font-weight: 700; color: var(--text); margin-right: auto; letter-spacing: -0.01em; }
.topnav { display: none; }
@media (max-width: 720px) {
  :root { --sidebar-w: 68px; }
  .nav-text { opacity: 0; width: 0; overflow: hidden; }
  .nav-link { padding: 11px 12px; gap: 0; }
  .sidebar-top { flex-direction: column; align-items: stretch; gap: 6px; }
  .mode-toggle { justify-content: center; gap: 0; padding: 0; }
}

header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 26px;
  padding: 14px 40px;
  /* Same tone as the page — solid (not transparent) so content scrolling
     underneath the sticky header stays hidden. */
  background: var(--bg);
}
h1 { font-size: 0.92rem; font-weight: 300; color: var(--muted); }
h1 .sub { color: var(--muted); font-weight: 400; font-size: 0.85rem; margin-left: 8px; }
h2 { font-size: 1rem; font-weight: 600; margin-bottom: 14px; }

.topnav { display: none; }
.topnav a {
  color: var(--muted); text-decoration: none; font-size: 0.92rem;
  padding: 10px 16px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.topnav a:hover { color: var(--text); }
.topnav a.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }

.live-price { display: flex; gap: 14px; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
.live-price .label { color: var(--text); font-weight: 700; }

main { width: 100%; margin: 0; padding: 0 40px 60px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.card {
  background-color: var(--card);
  border-radius: 12px;
  padding: 20px 22px;
  transition: transform 0.15s ease;
}
/* Flat look has no card borders, so cards INSIDE a panel need their own
   tone — in light theme card and panel are both white. */
.panel .card { background-color: var(--chip-bg); }
.card-label { color: var(--muted); font-size: 0.73rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; }
.card-value { font-size: 1.7rem; font-weight: 750; margin-top: 10px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.card.highlight .card-value { font-size: 1.95rem; }
.card-sub { color: var(--muted); font-size: 0.8rem; margin-top: 8px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.neutral { color: var(--muted); }

.filters {
  display: flex;
  align-items: flex-end;
  gap: 22px;
  flex-wrap: wrap;
  background: var(--panel);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
.filter label { display: block; color: var(--muted); font-size: 0.76rem; margin-bottom: 8px; }
.filter input[type="date"] {
  background: var(--chip-bg); color: var(--text);
  border: none; padding: 8px 12px;
  font-family: inherit;
}
/* Mute the native calendar icon to light grey instead of full white/black */
input::-webkit-calendar-picker-indicator { opacity: 0.6; cursor: pointer; }

/* Help "?" badge — its data-tip text renders via the global tooltip below */
.help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: 6px;
  background: var(--tag-bg); border-radius: 50%;
  font-size: 0.62rem; line-height: 1; color: var(--muted);
  cursor: help; position: relative; vertical-align: 1px; user-select: none;
}

/* Global tooltip (driven by common.js): EVERY hover text in the app — title
   attributes, .help badges — renders in this ONE flat box; native browser
   tooltips never appear (user convention). */
.ui-tip {
  position: fixed; left: 0; top: 0;
  width: max-content; max-width: 240px;
  background: var(--card-bg, var(--chip-bg)); color: var(--text);
  border-radius: 8px;
  padding: 8px 11px; font-size: 0.74rem; line-height: 1.5;
  font-weight: 400; text-align: left; white-space: normal;
  opacity: 0; visibility: hidden; transition: opacity 0.12s ease;
  pointer-events: none;
  z-index: 200; /* flat UI: no shadows, no borders — the fill alone lifts the overlay */
}
.ui-tip.show { opacity: 1; visibility: visible; }

/* Fixed-height chart wrappers — a responsive Chart.js canvas must live in a
   sized box, or canvas and container grow each other forever. */
.chart-box { position: relative; height: 330px; }
.chart-box-small { height: 130px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }

/* Strategy Lab controls */
.lab-controls { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.lab-controls select, .lab-controls input[type="number"], .lab-controls input[type="text"] {
  background: var(--chip-bg); color: var(--text);
  border: none; padding: 8px 12px;
  font-family: inherit; width: 132px;
}
.lab-controls select { width: auto; min-width: 132px; }
.lab-controls input:disabled { opacity: 0.35; cursor: not-allowed; }
.lab-controls input[type="range"] { width: 132px; accent-color: var(--text); margin-top: 6px; padding: 0; }
/* Asset field with the coin's icon inside, left of the symbol */
.asset-wrap { position: relative; display: inline-block; }
.lab-controls .asset-wrap input[type="text"] { padding-left: 38px; }
.asset-ic {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 20px; height: 20px; border-radius: 50%; pointer-events: none;
}
.asset-ic-fallback {
  background: var(--tag-bg); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.5rem; font-weight: 700; letter-spacing: 0.02em;
}
.btn-primary {
  background: var(--text); color: var(--bg); border: none;
  padding: 0 16px; font-weight: 600; font-size: 0.85rem; cursor: pointer;
  font-family: inherit; transition: opacity 0.12s ease;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.45; cursor: wait; }
.btn-ghost {
  background: var(--chip-bg); color: var(--text); border: none;
  padding: 0 16px; font-size: 0.85rem; cursor: pointer; font-family: inherit;
}
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }
/* Links dressed as buttons (navigation CTAs) — the UI never shows bare text
   links for actions, always primary/secondary buttons. */
a.btn-primary, a.btn-ghost {
  display: inline-flex; align-items: center; text-decoration: none;
}

/* ---------------- Smooth interactions (user convention 16/7) ---------------
   Every interactive control transitions its state changes (hover, focus,
   active, disabled) so the UI feels smooth. Scoped to the properties that
   actually change — and deliberately NOT to range sliders (a lagging thumb
   feels worse, not better). Open/close animations live with their components. */
button, a,
.asset-chip, .cm-tf, .cm-zoom button, .cm-close, .choice-chips > *,
.toggle, .badge, .rm-pill, .mode-badge, .tag-note, .help,
select, textarea,
input[type="text"], input[type="number"], input[type="date"], input[type="datetime-local"] {
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease,
    border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, fill 0.15s ease;
}

/* Confirmation dialog (heavy/destructive actions) — fades/scales in. */
.confirm-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  animation: overlay-in 0.14s ease;
}
.confirm-box {
  background: var(--panel);
  border-radius: 12px; padding: 22px 24px; max-width: 460px;
  width: calc(100% - 48px);
  animation: box-in 0.17s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes box-in { from { opacity: 0; transform: translateY(7px) scale(0.98); } to { opacity: 1; transform: none; } }
.confirm-box h3 { margin: 0 0 8px; font-size: 1.02rem; color: var(--text); }
/* Red (danger) variant — the kill switch dialog. The box carries the same
   red-tinted fill as the kill button's hover state. */
.confirm-box.danger { background: color-mix(in srgb, var(--red, #e5646e) 12%, var(--panel)); }
.confirm-box.danger h3 { color: var(--red, #e5646e); }
.confirm-box.danger .btn-primary { background: var(--red, #e5646e); color: #fff; }
.confirm-box.danger .btn-ghost { background: rgba(229, 100, 110, 0.14); color: var(--text); }
.confirm-box p { margin: 0 0 18px; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Coin cell in tables (logo + symbol), e.g. the screening ranking */
.coin-cell { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.coin-cell .asset-logo, .coin-cell .asset-initials {
  width: 22px; height: 22px; font-size: 0.55rem;
}
tr.row-excluded td { opacity: 0.55; }

.asset-filter { display: flex; gap: 8px; flex-wrap: wrap; }
.asset-chip {
  display: inline-flex; align-items: center; padding: 0 14px; cursor: pointer;
  background: var(--chip-bg); border: none; color: var(--muted);
  user-select: none; font-size: 0.83rem; transition: all 0.12s ease;
}
.asset-chip:hover { color: var(--text); }
.asset-chip.active { background: var(--text); color: var(--bg); font-weight: 600; }
/* Crisp SVG checkmark (shared mask) — replaces the blurry "✓" text glyph.
   The chevron mask matches the dropdowns' arrow (collapsible panel heads). */
:root {
  --check-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round' d='M4 12.5l5.5 5.5L20 6.5'/%3E%3C/svg%3E");
  --chev-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
.asset-chip.active::before {
  content: ""; width: 11px; height: 11px; margin-right: 7px; flex: none;
  background: currentColor;
  -webkit-mask: var(--check-mask) center / contain no-repeat;
          mask: var(--check-mask) center / contain no-repeat;
}

/* Crisp custom checkboxes — same checkmark as active chips, used everywhere */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 5px; margin: 0 7px 0 0;
  background: var(--chip-bg); border: none;
  vertical-align: -3px; cursor: pointer; position: relative;
  transition: background 0.12s ease;
}
input[type="checkbox"]:checked { background: var(--text); }
input[type="checkbox"]:checked::after {
  content: ""; position: absolute; inset: 2px;
  background: var(--bg);
  -webkit-mask: var(--check-mask) center / contain no-repeat;
          mask: var(--check-mask) center / contain no-repeat;
}

/* Inline SVG checkmark (checkIcon() in common.js) */
.check-icon { vertical-align: -1px; }

/* Platform filter tags: brand logo + colour, no checkmark, dimmed when off. */
.pf-chip { display: inline-flex; align-items: center; gap: 6px; opacity: 0.45; background: var(--chip-bg); color: var(--muted); font-weight: 600; }
.pf-chip::before, .pf-chip.active::before { content: none; }
.pf-chip .pf-logo { width: 14px; height: 14px; border-radius: 3px; display: block; }
.pf-chip:hover { opacity: 0.75; }
.pf-chip.active { opacity: 1; background: var(--chip-bg); }
.pf-chip[data-pf="binance"].active { color: #f0b90b; }
.pf-chip[data-pf="etoro"].active { color: var(--green); }
.pf-chip[data-pf="nordnet"].active { color: var(--text); }
.pf-chip[data-pf="kraken"].active { color: #9b8cff; }

.panel {
  background-color: var(--panel);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 24px;
}
/* Flush panel: groups content (head + collapsible) WITHOUT drawing its own box
   — avoids "box-in-box" when the content is already carded (e.g. the screening
   recommendation cards render as three cards, no outer box). Keeps spacing. */
.panel.flush { background: none; padding: 0; }
.panel.flush > :last-child { margin-bottom: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
/* Collapsible panels (user request 13/7: long ranking tables must fold away
   so the page keeps its overview). The whole head is the toggle; the chevron
   shows the state; the choice is remembered per page+section (common.js). */
.panel.collapsible > .panel-head { cursor: pointer; user-select: none; }
.panel.collapsible > .panel-head h2 { display: flex; align-items: center; gap: 9px; }
.panel.collapsible > .panel-head h2::before {
  content: ""; width: 13px; height: 13px; flex: none;
  background: var(--muted);
  -webkit-mask: var(--chev-mask) center / contain no-repeat;
          mask: var(--chev-mask) center / contain no-repeat;
  transition: transform 0.15s ease;
}
.panel.collapsible.closed > .panel-head h2::before { transform: rotate(-90deg); }
.panel.collapsible.closed > .panel-head h2 { margin-bottom: 0; }
.panel.collapsible.closed > :not(.panel-head) { display: none !important; }
.toggles { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.toggle { color: var(--muted); font-size: 0.84rem; cursor: pointer; }

.table-wrap { max-height: 460px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 9px 12px; font-size: 0.85rem; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2), th:nth-child(3), td:nth-child(3) { text-align: left; }
/* UI convention: table headers are ALWAYS sticky. Inside a scrolling
   .table-wrap they pin to the wrap's top; in full-page tables
   (.table-wrap-full) they pin just below the sticky page header, whose
   height common.js publishes as --header-h. */
thead th { position: sticky; top: var(--thead-top, 0); background: var(--panel); color: var(--muted); font-weight: 500; z-index: 1; cursor: pointer; user-select: none; }
.table-wrap { --thead-top: 0px; }
tbody tr:hover { background: var(--chip-bg); }
td.side-BUY { color: var(--green); font-weight: 600; }
td.side-SELL { color: var(--red); font-weight: 600; }
#fee-tiers-body tr.fee-current { background: var(--chip-bg); }
#fee-tiers-body tr.fee-current td { font-weight: 600; }
/* Fee panel rhythm: head, controls, cards and table each get their own row */
#fee-panel .panel-head { margin-bottom: 14px; }
#fee-panel .panel-head h2 { margin-bottom: 0; }
#fee-panel .lab-controls { margin-bottom: 18px; }
#fee-panel .cards { margin-bottom: 18px; }
/* List everything on the page — no inner scrollbars; the header pins below
   the sticky page header instead. */
.table-wrap-full { max-height: none; overflow-y: visible; --thead-top: var(--header-h, 62px); }

/* Screening recommendation cards: scannable fact rows, reasoning behind a
   fold-out, small note pills (kept/high risk). */
.card-facts { margin-top: 10px; }
.tag-note {
  background: var(--chip-bg); color: var(--muted); font-size: 0.68rem;
  font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-left: 6px;
}
.scr-why summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; margin-top: 10px; user-select: none; }
.scr-why summary:hover { color: var(--text); }
.scr-why p { color: var(--muted); font-size: 0.8rem; line-height: 1.55; margin: 6px 0 0; }
/* Screening capital selector (header): mode select + 500-USD-step slider */
.scr-cap { display: inline-flex; align-items: center; gap: 10px; }
.scr-cap select {
  background: var(--chip-bg); color: var(--text); border: none;
  padding: 0 12px; font-family: inherit; font-size: 0.88rem;
}
.scr-cap input[type="range"] { width: 150px; accent-color: var(--text); }
.scr-cap #scr-cap-val { min-width: 86px; text-align: right; }

/* Small inline spinner: put before a status text while data is processing */
.spinner {
  display: inline-block; width: 13px; height: 13px; vertical-align: -2px;
  border: 2px solid var(--border); border-top-color: var(--text);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin-right: 7px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.disclaimer { color: var(--muted); font-size: 0.75rem; margin-top: 12px; }
/* Loose explanatory text shown directly on a page (not inside a box) is
   constrained (max-width) and LEFT-aligned for readability (user request 16/7).
   Disclaimers inside a .panel are unaffected — they're already boxed. */
main > .disclaimer { max-width: 800px; }

/* User rights matrix (Settings > Brugere): grouped to mirror the menu (a parent
   like "Strategy Lab" with its sub-pages indented). No scroll — the whole list
   shows (user request). */
/* Breadcrumb heading (e.g. Brugere › Brugernavn) — the parent is a link back. */
.crumb { color: var(--muted); text-decoration: none; transition: color 0.15s ease; }
.crumb:hover { color: var(--text); }
.crumb-sep { color: var(--muted); margin: 0 3px; font-weight: 400; }

.us-create-fields { display: flex; flex-direction: column; gap: 10px; margin: 0 0 18px; }
.us-create-fields input { width: 100%; }
.rights-table { max-width: 640px; }
.rights-table td input[type="checkbox"] { margin: 0; vertical-align: middle; }
.us-group td { font-weight: 700; color: var(--text); padding-top: 22px; letter-spacing: 0.01em; }
.us-group:first-child td { padding-top: 6px; }
.us-sub td:first-child { padding-left: 26px; }

/* ---------------- Road Map — curated timeline of cards (Strategy Lab) ------
   Each event is its OWN card; a continuous vertical spine runs down the left
   gutter and threads through every card via a node dot. Flat like everything
   else — the spine is the one explicit, intentional line. Hand-curated. */
.roadmap { position: relative; padding-left: 144px; }
.roadmap::before {
  content: ""; position: absolute; left: 120px; top: 10px; bottom: 10px;
  width: 2px; background: var(--border);
}
.rm-item {
  position: relative;
  background: var(--panel); border-radius: 14px;
  padding: 16px 20px; margin-bottom: 14px;
}
.rm-item:last-child { margin-bottom: 0; }
/* The date lives in the left gutter, right-aligned toward the spine; the card
   sits to the right of the spine. */
.rm-when {
  position: absolute; left: -144px; top: 18px; width: 104px; text-align: right;
  color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600; line-height: 1.35;
}
/* Node dot, centered on the 2px spine (spine center x = 120 + 1 = 121px; card
   left edge = padding-left 144px; so node left = 121 - 6 - 144 = -29px).
   Outlined in the page background so the spine reads as running behind it. */
.rm-item::before {
  content: ""; position: absolute; left: -29px; top: 20px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--muted); outline: 4px solid var(--bg);
}
.rm-item.is-now::before { background: var(--blue); }
.rm-item.is-running::before { background: var(--green); }
.rm-item.is-await::before { background: var(--amber); }
.rm-item.is-gated::before { background: var(--border); }
/* The present card gets a faint tint so "you are here" stands out. */
.rm-item.is-now { background: rgba(90, 169, 230, 0.10); }
/* Upcoming events (anything not yet done and not the present) get a very faint
   diagonal hatch — a discreet "pending / still ahead" texture that stays out of
   the way of the text on top. Sparse + low-alpha so it reads as subtle shading. */
.rm-item:not(.is-done):not(.is-now) {
  background-image: repeating-linear-gradient(-45deg,
    transparent 0, transparent 10px,
    rgba(130, 140, 160, 0.06) 10px, rgba(130, 140, 160, 0.06) 11px);
}
/* Delivered: a plain green dot on the timeline; the completion mark is a BIG
   green check on the RIGHT of the card (padding reserves room for it). */
.rm-item.is-done::before { background: var(--green); }
.rm-item.is-done { padding-right: 58px; }
.rm-item.is-done::after {
  content: ""; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; background: var(--green);
  -webkit-mask: var(--check-mask) center / contain no-repeat;
          mask: var(--check-mask) center / contain no-repeat;
}
.rm-title { font-size: 1rem; font-weight: 650; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; }
/* Each card folds: the title row is the toggle (chevron shows the state). A
   collapsed card still shows date + title + status, so the overview survives;
   only the body/why hide. Defaults set in roadmap.js (open = work in progress). */
.rm-title::before {
  content: ""; width: 12px; height: 12px; flex: none; order: -1;
  background: var(--muted);
  -webkit-mask: var(--chev-mask) center / contain no-repeat;
          mask: var(--chev-mask) center / contain no-repeat;
  transition: transform 0.15s ease;
}
.rm-item.collapsed .rm-title::before { transform: rotate(-90deg); }
/* Smooth fold: the body/why are wrapped (in roadmap.js) in a grid container
   that animates its row from 1fr → 0fr. fold-ready is added after the initial
   state paints, so the first render doesn't animate. */
.rm-fold { display: grid; grid-template-rows: 1fr; }
.rm-fold-inner { min-height: 0; overflow: hidden; }
.rm-item.fold-ready .rm-fold { transition: grid-template-rows 0.24s ease, opacity 0.2s ease; }
.rm-item.collapsed .rm-fold { grid-template-rows: 0fr; opacity: 0; }
/* Historical (delivered) milestones are hidden by default; a discreet text
   toggle at the top reveals them. Keeps the timeline focused on now + ahead.
   Pre-JS fallback: hide the delivered cards while they're still direct children
   (before roadmap.js wraps them into the animatable .rm-history container). */
.roadmap.hide-history > .rm-item.is-done { display: none; }
/* Smooth reveal: the delivered cards are wrapped in a grid container that
   animates 1fr↔0fr. The wrapper spans the full width (negative margin cancels
   the roadmap's left padding) so overflow:hidden never clips the gutter
   (spine/node/date); the cards re-add the gutter via their own margin. */
.rm-history { display: grid; grid-template-rows: 1fr; margin-left: -144px; margin-bottom: 14px; }
.rm-history-inner { min-height: 0; overflow: hidden; }
.rm-history .rm-item { margin-left: 144px; }
/* The last card's own bottom margin is clipped by the overflow:hidden inner —
   put the gap to the next card on the wrapper instead so it always shows. */
.rm-history-inner > .rm-item:last-child { margin-bottom: 0; }
.roadmap.hist-ready .rm-history { transition: grid-template-rows 0.28s ease; }
.roadmap.hide-history .rm-history { grid-template-rows: 0fr; }
.rm-history-toggle {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 12px;
  background: none; border: none; cursor: pointer; font: inherit;
  color: var(--muted); font-size: 0.82rem; font-weight: 600;
}
.rm-history-toggle:hover { color: var(--text); }
.rm-history-toggle::before {
  content: ""; width: 11px; height: 11px; flex: none;
  background: currentColor;
  -webkit-mask: var(--chev-mask) center / contain no-repeat;
          mask: var(--chev-mask) center / contain no-repeat;
  transform: rotate(-90deg); transition: transform 0.15s ease;
}
.rm-history-toggle[aria-expanded="true"]::before { transform: none; }
/* Narrow screens: fold the date back above the card, spine to the far left. */
@media (max-width: 620px) {
  .roadmap { padding-left: 26px; }
  .roadmap::before { left: 7px; }
  .rm-when { position: static; width: auto; text-align: left; margin-bottom: 3px; }
  .rm-item::before { left: -24px; top: 18px; }
  .rm-history { margin-left: -26px; }
  .rm-history .rm-item { margin-left: 26px; }
}
.rm-body, .rm-why { color: var(--muted); font-size: 0.86rem; margin-top: 7px; max-width: 74ch; line-height: 1.55; }
.rm-why strong, .rm-body strong { color: var(--text); font-weight: 600; }
.rm-pill {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; background: var(--tag-bg); color: var(--muted);
}
.rm-pill.p-now, .rm-pill.p-recurring { background: rgba(90, 169, 230, 0.16); color: var(--blue); }
.rm-pill.p-running { background: rgba(52, 201, 142, 0.16); color: var(--green); }
.rm-pill.p-await { background: rgba(223, 166, 63, 0.18); color: var(--amber); }
/* Delivered pill — plain green label; the completion checkmark is the big one
   on the right of the card. */
.rm-pill.p-done { background: rgba(52, 201, 142, 0.16); color: var(--green); }

/* Two columns: the timeline, and a compact right rail listing recurring tasks
   so they're not scattered through the timeline (each recurring event shows
   ONCE on the timeline, at its next date). Stacks on narrow viewports. */
.roadmap-layout { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: 34px; align-items: start; margin-top: 8px; }
@media (max-width: 900px) { .roadmap-layout { grid-template-columns: 1fr; gap: 24px; } }
.roadmap-recurring { position: sticky; top: calc(var(--header-h, 60px) + 16px); }
.rm-rec-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.rm-rec-head svg { width: 15px; height: 15px; color: var(--blue); }
.rm-rec { background: var(--chip-bg); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.rm-rec-title { font-size: 0.92rem; font-weight: 600; }
.rm-rec-cadence { color: var(--muted); font-size: 0.8rem; margin-top: 5px; line-height: 1.45; }
.rm-rec-next { color: var(--blue); font-size: 0.78rem; font-weight: 600; margin-top: 8px; }


.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  padding: 4px 12px; border-radius: 999px; font-size: 0.75rem;
  background: var(--tag-bg); color: var(--muted);
}
.badge.done { background: rgba(52, 201, 142, 0.14); color: var(--green); }
.sub-h { margin-top: 22px; font-size: 0.92rem; color: var(--muted); }
/* .sub-h's top margin is for use under panels; in the flex header and in
   panel heads it must sit on the shared center line. */
header .sub-h, .panel-head .sub-h { margin-top: 0; }
#nav-table td.neg-row { color: var(--red); }
#nav-table td.pos-row { color: var(--green); }

.pf-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.pf-logo { width: 14px; height: 14px; border-radius: 3px; display: block; }
.pf-binance { background: rgba(240, 185, 11, 0.14); color: #f0b90b; }
.pf-nordnet { background: var(--tag-bg); color: var(--text); }
.pf-kraken { background: rgba(87, 65, 217, 0.18); color: #9b8cff; }

/* Icon-only buttons (e.g. the PDF button on Tax Report) */
.btn-icon { display: inline-flex; align-items: center; justify-content: center;
  padding: 0; width: var(--ctrl-h); }

/* Amounts carrying the alternative-currency conversion in a hover tooltip */
.money-hover { cursor: default; }
.money-hover:hover { text-decoration: underline dotted; text-underline-offset: 3px; }

/* Settings page: collapsible groups; each row = name+description left, choice chips right */
/* Same chevron as the collapsible panels (screening) — hide the native
   disclosure triangle and use the shared --chev-mask, rotating with [open]. */
.settings-group summary {
  display: flex; align-items: center; gap: 9px;
  cursor: pointer; font-size: 1.02rem; font-weight: 600; user-select: none;
  list-style: none;
}
.settings-group summary::-webkit-details-marker { display: none; }
.settings-group summary::before {
  content: ""; width: 13px; height: 13px; flex: none;
  background: var(--muted);
  -webkit-mask: var(--chev-mask) center / contain no-repeat;
          mask: var(--chev-mask) center / contain no-repeat;
  transform: rotate(-90deg); transition: transform 0.15s ease;
}
.settings-group[open] summary::before { transform: none; }
/* Rows are capped in width and get a hover fill, so it is always obvious
   which text belongs to which field (user decision 12/7). */
.setting-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 18px; flex-wrap: wrap; padding: 14px 12px; margin: 0 -12px;
  max-width: 860px; border-radius: 11px;
}
.setting-row:hover { background: var(--tag-bg); }
.setting-name { font-weight: 600; font-size: 0.92rem; }
.setting-desc { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }
.setting-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.setting-example { color: var(--muted); font-size: 0.85rem; margin: 12px 0 0; }
.risk-input { align-items: center; gap: 8px; }
.risk-input input {
  width: 92px; background: var(--chip-bg); border: none; color: var(--text);
  padding: 0 12px; font-family: inherit; font-size: 0.88rem; text-align: right;
  height: var(--ctrl-h); border-radius: var(--ctrl-r);
}
.setting-unit { color: var(--muted); font-size: 0.82rem; min-width: 26px; }
/* "Can block margin" tag (user decision 12/7): flags the risk limits that can
   reject every margin entry, so the gate never comes as a surprise. */
.margin-tag {
  display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 999px;
  font-size: 0.68rem; font-weight: 600; vertical-align: 2px; cursor: default;
  background: rgba(212, 148, 30, 0.16); color: var(--amber);
}

/* Live/Paper environment switch (sidebar) + header badge — the two worlds
   (real account data vs simulation) are never shown mixed. */
.mode-badge {
  font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 999px; margin-left: 10px; vertical-align: 2px;
}
.mode-badge.mode-paper { background: rgba(230, 160, 60, 0.16); color: #d9962e; }
.mode-badge.mode-live { background: rgba(46, 204, 113, 0.14); color: var(--green, #2ecc71); }
/* Real-money elements on a paper-world page are unmistakably marked (user
   decision 15/7 — option 1): red REAL ORDERS badge in the panel header. */
.mode-badge.mode-real { background: rgba(224, 82, 82, 0.16); color: #e05252; }

/* Assets cash line (user request 13/7): free fiat/stable cash per platform,
   one flat row above the asset cards. */
.cash-line { display: flex; flex-direction: column; gap: 10px; }
.cash-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cash-row .cash-title { font-weight: 700; }
.cash-group { display: inline-flex; align-items: center; gap: 10px; }
.cash-amt { color: var(--muted); cursor: default; font-variant-numeric: tabular-nums; }
.cash-total { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Coin logo -> Kraken Pro trade page (new tab, user request 13/7). */
.coin-link { display: inline-flex; align-items: center; }

/* Gross -> Fees -> Net breakdown (user convention 13/7): muted sub right
   under the big NET number on P/L- and ROI-displays. */
.grossnet-sub { font-variant-numeric: tabular-nums; }
.asset-pnl-sub { color: var(--muted); font-size: 0.78rem; margin: -8px 0 12px; }

/* ---------------- Platforms: connection cards ------------------------------ */
.pf-big-logo { width: 40px; height: 40px; border-radius: 10px; }
.pf-state {
  margin-left: auto; padding: 3px 10px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600; white-space: nowrap;
}
.pf-state.on { background: rgba(46, 204, 113, 0.14); color: var(--green, #2ecc71); }
.pf-state.warn { background: rgba(229, 100, 110, 0.14); color: var(--red, #e5646e); }
.pf-state.off { background: var(--tag-bg); color: var(--muted); }
.perm-row { display: flex; gap: 8px; margin: 4px 0 10px; flex-wrap: wrap; }
.perm-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
  border-radius: 999px; font-size: 0.74rem; background: var(--tag-bg);
  color: var(--muted); opacity: 0.65; /* inactive = dimmed, never line-through */
}
.perm-badge.on {
  background: rgba(46, 204, 113, 0.14); color: var(--green, #2ecc71);
  opacity: 1; font-weight: 600;
}

/* ---------------- Tax Report: document sheet -------------------------------
   On SCREEN the sheet follows the normal light/dark theme; when PRINTED
   ("Save as PDF") it is ALWAYS light letterhead paper. All colors go through
   the --tx-* variables so the print block only swaps the palette. */
.tax-sheet {
  --tx-bg: var(--panel); --tx-text: var(--text); --tx-muted: var(--muted);
  --tx-line: var(--border); --tx-strong: var(--text); --tx-head: var(--chip-bg);
  background: var(--tx-bg); color: var(--tx-text); max-width: 980px; margin: 0 auto;
  padding: 42px 48px 64px; border-radius: 10px;
  font-size: 0.86rem; line-height: 1.5;
}
.tax-sheet h1 { font-size: 1.25rem; margin: 0 0 4px; color: var(--tx-text); }
/* Yellow "preliminary" tag on the current-year report (prints in the PDF). */
.tax-prelim {
  display: inline-block; vertical-align: middle; margin-left: 8px;
  padding: 2px 9px; border-radius: 999px;
  background: #fcefc3; color: #8a6209;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.tax-sheet h3 { font-size: 0.98rem; margin: 26px 0 8px; color: var(--tx-text); }
.tax-letterhead {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; border-bottom: 2px solid var(--tx-strong); padding-bottom: 14px; margin-bottom: 8px;
}
.tax-company { font-size: 1.05rem; font-weight: 700; white-space: nowrap; }
.tax-letterhead > div:first-child { flex: none; }
.tax-cvr, .tax-sub { color: var(--tx-muted); font-size: 0.8rem; }
.tax-title { text-align: right; }
.tax-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tax-table th, .tax-table td {
  border-bottom: 1px solid var(--tx-line); padding: 6px 8px; text-align: left;
  font-size: 0.8rem; color: var(--tx-text); background: none;
}
.tax-table thead th { position: static; background: var(--tx-head); color: var(--tx-muted);
  font-weight: 600; cursor: default; }
.tax-table .num, .tax-table th.num { text-align: right; }
.tax-table .src { color: var(--tx-muted); font-size: 0.72rem; }
.tax-table tfoot th { border-top: 2px solid var(--tx-strong); font-weight: 700; text-align: left;
  background: none; color: var(--tx-text); position: static; cursor: default; }
.tax-table tfoot th.num, .tax-table tfoot th:nth-child(2) { text-align: right; }
.tax-summary td { font-size: 0.86rem; }
.tax-result td { font-weight: 700; border-top: 2px solid var(--tx-strong); }
/* Gross-holding / loan / net breakdown rows (summary + valuation tables). */
.tax-sub-row td { color: var(--tx-muted); padding-left: 22px; }
.tax-subtotal-row td { font-weight: 600; }
.tax-subhead td { color: var(--tx-muted); font-size: 0.74rem; font-style: italic;
  padding-top: 10px; }
.tax-subtotal th { font-weight: 600; text-align: left; }
.tax-subtotal th.num { text-align: right; }
.tax-note { color: var(--tx-muted); font-size: 0.78rem; }

@media print {
  .sidebar, header, .no-print { display: none !important; }
  html, body { background: #fff !important; }
  body { margin: 0 !important; } /* undo the sidebar offset (body margin-left) */
  main { margin: 0 !important; padding: 0 !important; }
  .tax-sheet {
    /* Letterhead paper: always light in the PDF regardless of UI theme */
    --tx-bg: #fff; --tx-text: #1c222c; --tx-muted: #5a6372;
    --tx-line: #d9dde3; --tx-strong: #1c222c; --tx-head: #f2f4f7;
    border: none; border-radius: 0; max-width: none; padding: 0 0 46px;
  }
  /* Letterhead footer in the page margin on EVERY page: company + CVR left,
     page numbers ("1 / 3") right. @page margin boxes — Chromium 131+. */
  @page {
    margin: 16mm 13mm 20mm;
    @bottom-left {
      content: "M. R. Holding ApS · CVR-nr. 40680306";
      font-size: 9px; color: #5a6372;
      font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    }
    @bottom-right {
      content: counter(page) " / " counter(pages);
      font-size: 9px; color: #5a6372;
      font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    }
  }
}

/* Kill switch (in the scrollable actions group) — always red, hover intensifies.
   Selectors include .sidebar-actions to outrank the shared nav-link reset. */
.sidebar-actions .kill-btn { color: var(--red, #e5646e); }
.sidebar-actions .kill-btn:hover { color: var(--red, #e5646e); background: rgba(229, 100, 110, 0.12); }

.assets-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-bottom: 24px; }
.asset-card { background-color: var(--card); border-radius: 14px; padding: 22px; }
.asset-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.asset-logo { width: 40px; height: 40px; border-radius: 50%; }
.asset-initials {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; color: #fff; flex-shrink: 0;
}
.asset-title { flex: 1; min-width: 0; }
.asset-ticker { font-weight: 650; font-size: 1.02rem; }
.asset-name { color: var(--muted); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-pnl { font-size: 1.55rem; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-bottom: 14px; }
.asset-roi { font-size: 0.85rem; font-weight: 600; margin-left: 10px; }
.fact-row { display: flex; justify-content: space-between; font-size: 0.83rem; padding: 4px 0; }
.fact-row .k { color: var(--muted); }
.fact-row .v { font-variant-numeric: tabular-nums; }
.rank-badge { font-size: 0.72rem; color: var(--muted); }

.pf-etoro { background: rgba(52, 201, 142, 0.16); color: var(--green); }

.avg-sub { font-size: 0.72rem; }

th.sort-asc::after { content: " \25B4"; }
th.sort-desc::after { content: " \25BE"; }

/* ---------------- Clickable asset cards + price-history popup ---------------- */
.asset-card.clickable { cursor: pointer; transition: transform 0.12s ease; }
.asset-card.clickable:hover { transform: translateY(-2px); }
.asset-card.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.asset-card { position: relative; }

body.modal-open { overflow: hidden; }
.chart-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.chart-modal[hidden] { display: none; }
.cm-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px); }
.cm-box {
  position: relative; width: min(1040px, 94vw); max-height: 90vh;
  display: flex; flex-direction: column; background: var(--panel);
  border-radius: 12px; overflow: hidden;
}
.cm-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 18px;
}
.cm-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.cm-ticker { font-size: 1.25rem; font-weight: 700; color: var(--text); }
.cm-name { color: var(--muted); font-size: 0.9rem; }
.cm-period { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.cm-roi { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.cm-tf { margin-left: auto; display: inline-flex; align-items: center; background: var(--chip-bg); border: none; padding: 2px; }
.cm-tf button {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 0.82rem; padding: 5px 12px; border-radius: 7px; transition: background 0.12s ease, color 0.12s ease;
}
.cm-tf button:hover { color: var(--text); }
.cm-tf button.active { background: var(--text); color: var(--bg); font-weight: 600; }
.cm-close {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 1.5rem; line-height: 1; padding: 0 4px; border-radius: 6px;
}
.cm-close:hover { color: var(--text); }
.cm-body { position: relative; flex: 1; min-height: 340px; height: 58vh; padding: 14px 18px; }
.cm-body canvas { width: 100% !important; height: 100% !important; }
.cm-zoom { position: absolute; top: 18px; left: 20px; display: flex; gap: 5px; z-index: 4; }
.cm-zoom button {
  width: var(--ctrl-h); cursor: pointer;
  background: var(--card); border: none; color: var(--muted);
  font-size: 1rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.12s ease;
}
.cm-zoom button:hover { color: var(--text); }
.cm-tooltip {
  position: absolute; pointer-events: none; z-index: 5; opacity: 0;
  transform: translate(-50%, calc(-100% - 14px)); transition: opacity 0.1s ease;
  background: var(--panel); color: var(--text);
  border-radius: 8px; padding: 8px 11px;
  font-size: 0.8rem; line-height: 1.55; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cm-tooltip .tt-date { color: var(--muted); font-size: 0.72rem; margin-bottom: 3px; }
.cm-tooltip .tt-avg { font-weight: 700; }
.cm-status {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.9rem; text-align: center; padding: 0 24px;
}
/* When empty/hidden it must not cover the canvas and swallow hover events. */
.cm-status[hidden] { display: none; }
.cm-foot {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 18px; font-size: 0.78rem; color: var(--muted);
}
.cm-key { display: inline-flex; align-items: center; gap: 6px; }
.cm-dot { width: 10px; height: 10px; display: inline-block; }
.cm-dot.buy { background: var(--green); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.cm-dot.sell { background: var(--red); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.cm-line { width: 18px; height: 2px; background: var(--text); display: inline-block; }
.cm-band { width: 16px; height: 12px; border-radius: 2px; display: inline-block;
  background: linear-gradient(to bottom, rgba(52, 201, 142, 0.6), rgba(229, 100, 110, 0.6)); }
.cm-hint { margin-left: auto; opacity: 0.75; }

@media (max-width: 620px) {
  .cm-tf { margin-left: 0; }
  .cm-body { height: 50vh; }
  .cm-hint { display: none; }
}

/* ---------------- Paper trading ---------------- */
/* Accept/reject row on recommendation cards + small table buttons. The
   double-class selectors out-rank the unified-controls height rule below. */
.card-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.btn-primary.btn-sm, .btn-ghost.btn-sm {
  height: 30px; padding: 0 12px; font-size: 0.78rem; border-radius: 8px;
}
.confirm-amount { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; }
.confirm-amount span { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.confirm-amount input { flex: 1; background: var(--chip-bg); border: none; color: var(--text); padding: 0 12px; font-family: inherit; font-size: 0.92rem; }
/* Choice chips in confirmAmount (e.g. the leverage picker) — asset-chip look */
.choice-chips { display: flex; gap: 8px; flex-wrap: wrap; }
/* Decision-log detail column: readable multi-line text, left-aligned */
#pp-log-body td.pp-detail { text-align: left; white-space: normal; line-height: 1.45; color: var(--muted); max-width: 480px; }
#pp-body tr { cursor: pointer; }

/* ---------------- Sidetrade mini-trade experiment (screening page) ---------
   Inline log form: flat labeled inputs, shown only while logging/editing. */
#stm-form { display: none; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 12px 0 6px; }
#stm-form.show { display: flex; }
#stm-form label {
  display: flex; flex-direction: column; gap: 5px;
  color: var(--muted); font-size: 0.73rem; text-transform: uppercase; letter-spacing: 0.08em;
}
#stm-form input:not([type="checkbox"]), #stm-form select {
  background: var(--chip-bg); color: var(--text); border: none;
  padding: 0 12px; font-family: inherit; font-size: 0.88rem; width: 158px;
}
#stm-form label.stm-check { flex-direction: row; align-items: center; gap: 8px; padding-bottom: 8px; }
#stm-table-body .btn-ghost { margin-right: 6px; }

/* ---------------- Unified controls (keep LAST — wins the cascade) ----------
   Every button shares the exact same height and corner radius as inputs,
   selects and textareas (--ctrl-h / --ctrl-r). Flat look: fills, no borders. */
input[type="date"], input[type="datetime-local"], input[type="number"],
input[type="text"], select,
.btn-primary, .btn-ghost, .asset-chip, .cm-tf, .cm-zoom button,
.cm-close {
  height: var(--ctrl-h);
  border-radius: var(--ctrl-r);
}
textarea { border-radius: var(--ctrl-r); }
/* Dropdowns match the flat control design everywhere: chip fill, custom
   chevron (appearance:none removes the native arrow), themed option list. */
select {
  appearance: none; -webkit-appearance: none;
  background-color: var(--chip-bg); color: var(--text); border: none;
  padding: 0 32px 0 12px; font-family: inherit; font-size: 0.88rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%238a93a5' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 12px;
}
select:hover { color: var(--text); }
select option, select optgroup { background: var(--panel); color: var(--text); }
/* No native up/down spinners on ANY number input (user decision 11/7) */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cm-tf button { border-radius: calc(var(--ctrl-r) - 2px); }
.cm-close { width: var(--ctrl-h); }
