:root {
    --bg: #060a12;
    --bg-2: #04070e;
    --panel: #0a121f;
    --panel-2: #070d18;
    --text: #e6edf7;
    --muted: #9fb0c8;
    --border: #1c2a44;
    --border-strong: rgba(147, 197, 253, 0.18);
    --ok: #22c55e;
    --warn: #f59e0b;
    --bad: #ef4444;
    --accent: #60a5fa;
    --accent-2: #38bdf8;
    --chip: #111f36;
    --link: #93c5fd;
    --card-bg: rgba(15, 26, 46, 0.75);
    --card-border: #1c2a44;
    --card-border-strong: rgba(147, 197, 253, 0.16);
    --card-shadow: 0 10px 30px rgba(0,0,0,.25);
    --panel-soft: rgba(12, 22, 41, 0.75);
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
    --v-sidebar-expanded: 260px;
    --v-sidebar-collapsed: 72px;
    --v-sidebar-w: var(--v-sidebar-expanded);
}

html.v-sidebar-collapsed:not(.v-sidebar-mobile-open) {
    --v-sidebar-w: var(--v-sidebar-collapsed);
}

* {
    box-sizing: border-box;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

*::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.table-wrap,
.json-box,
[data-drag-scroll] {
    cursor: grab;
    -webkit-overflow-scrolling: touch;
}

.table-wrap.is-drag-scrolling,
.json-box.is-drag-scrolling,
[data-drag-scroll].is-drag-scrolling {
    cursor: grabbing;
    user-select: none;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 0%, rgba(37, 99, 235, 0.09), transparent 42%),
        radial-gradient(circle at 88% 12%, rgba(14, 165, 233, 0.06), transparent 38%),
        linear-gradient(180deg, #020408 0%, #03060c 45%, #020306 100%);
    color: var(--text);
    font-family: var(--sans);
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.layout {
    display: grid;
    grid-template-columns: var(--v-sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.main {
    padding: 16px 18px 28px;
    min-width: 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 14px;
}

select,
input[type="text"],
input[type="search"],
input[type="number"],
textarea {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 16, 34, 0.72);
    color: var(--text);
    font-size: 12px;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

textarea {
    min-height: 120px;
    padding: 10px 12px;
    resize: vertical;
}

select {
    padding-right: 28px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 34px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid rgba(122,162,255,.35);
    background: rgba(122,162,255,.12);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: none;
}

.btn:hover {
    text-decoration: none;
    border-color: rgba(122,162,255,.35);
    background: rgba(122,162,255,.18);
    box-shadow: none;
}

.btn.primary {
    border-color: rgba(122,162,255,.35);
    background: rgba(122,162,255,.12);
}

.btn.danger {
    color: #fff1f2;
    border-color: rgba(239, 68, 68, 0.28);
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.20), rgba(239, 68, 68, 0.08));
}

.mono {
    font-family: var(--mono);
    font-size: 12px;
}

.muted {
    color: var(--muted);
}

.ok {
    color: var(--ok);
}

.warn {
    color: var(--warn);
}

.bad {
    color: var(--bad);
}

.right {
    margin-left: auto;
}

.small {
    font-size: 11px;
}

.chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chip,
.pill,
.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(12,22,41,.7);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    line-height: 1;
    box-shadow: none;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--muted);
}

.dot.ok {
    background: var(--ok);
}

.dot.warn {
    background: var(--warn);
}

.dot.bad {
    background: var(--bad);
}

/* Unified risk/signal badges across pages */
.signal-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.72);
    color: #cbd5e1;
}

.signal-chip--synthetic {
    border-color: rgba(245, 158, 11, 0.30);
    background: rgba(120, 53, 15, 0.22);
    color: #fde68a;
}

.signal-chip--degraded {
    border-color: rgba(251, 191, 36, 0.34);
    background: rgba(113, 63, 18, 0.25);
    color: #fef08a;
}

.signal-chip--risk-off {
    border-color: rgba(239, 68, 68, 0.30);
    background: rgba(127, 29, 29, 0.22);
    color: #fca5a5;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
    font-size: 12px;
}

th,
td {
    padding: 10px 8px;
    vertical-align: top;
    text-align: left;
}

th {
    color: rgba(159,176,200,.75);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.card,
.panel,
.surface {
    position: relative;
    overflow: hidden;
    min-width: 0;
    border-radius: 14px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    box-shadow: var(--card-shadow);
}

.card::before,
.panel::before,
.surface::before {
    display: none;
}

.card > .hd,
.panel > .hd,
.surface > .hd,
.modal .hd {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 56px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: transparent;
}

.card > .hd h2,
.panel > .hd h2,
.surface > .hd h2 {
    margin: 0;
    color: rgba(230,237,247,.92);
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .045em;
}

.card > .bd,
.panel > .bd,
.surface > .bd,
.card > .body,
.panel > .body,
.surface > .body {
    position: relative;
    z-index: 1;
    padding: 12px 14px;
    min-width: 0;
}

.card .empty,
.panel .empty,
.surface .empty,
.block .empty,
.metric .empty,
.ref-item .empty,
.result-item .empty {
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 0;
    color: var(--muted);
    text-align: left;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal {
    width: min(980px, 92vw);
    max-height: 86vh;
    overflow: auto;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: linear-gradient(180deg, rgba(14, 24, 45, 0.98), rgba(8, 16, 33, 0.96));
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

pre {
    margin: 0;
    padding: 12px 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.col-12 { grid-column: span 12; }
.col-10 { grid-column: span 10; }
.col-8  { grid-column: span 8; }
.col-7  { grid-column: span 7; }
.col-6  { grid-column: span 6; }
.col-5  { grid-column: span 5; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }

@media (max-width: 1180px) {
    .layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .main {
        padding: 14px;
    }

    .col-10,
    .col-8,
    .col-7,
    .col-6,
    .col-5,
    .col-4,
    .col-3 {
        grid-column: span 12;
    }
}

/* shell lock */
body > .layout {
    display: grid !important;
    grid-template-columns: var(--v-sidebar-w) minmax(0, 1fr) !important;
    min-height: 100vh !important;
}

body > .layout > .sidebar {
    grid-column: 1 !important;
    width: var(--v-sidebar-w) !important;
    min-width: var(--v-sidebar-w) !important;
    max-width: var(--v-sidebar-w) !important;
}

body > .layout > .content {
    grid-column: 2 !important;
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
}

body > .layout > .content > .main {
    padding: 16px 18px 28px !important;
    min-width: 0 !important;
}

@media (max-width: 1180px) {
    body > .layout {
        grid-template-columns: 1fr !important;
    }

    body > .layout > .sidebar {
        grid-column: 1 !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }

    body > .layout > .content {
        grid-column: 1 !important;
    }
}


/* global background lock: match ML */
html,
body {
    background: linear-gradient(180deg, #081022 0%, #070d18 100%) !important;
}/* zero top gap lock */
html,
body {
    margin: 0 !important;
    padding: 0 !important;
}
body > .layout {
    margin-top: 0 !important;
    padding-top: 0 !important;
    align-items: start !important;
}
body > .layout > .content {
    margin-top: 0 !important;
    padding-top: 0 !important;
    justify-content: flex-start !important;
}

/* stable shell lock */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 100vh !important;
    background:
        radial-gradient(circle at 18% 0%, rgba(37, 99, 235, 0.08), transparent 42%),
        radial-gradient(circle at 88% 12%, rgba(14, 165, 233, 0.05), transparent 38%),
        linear-gradient(180deg, #020408 0%, #03060c 45%, #020306 100%) !important;
}

body > .layout {
    display: grid !important;
    grid-template-columns: var(--v-sidebar-w) minmax(0, 1fr) !important;
    min-height: 100vh !important;
    align-items: start !important;
    margin: 0 !important;
    padding: 0 !important;
}

body > .layout > .content {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

body > .layout > .content > .main {
    display: block !important;
    min-width: 0 !important;
    padding: 16px 18px 28px !important;
    margin: 0 !important;
}

/* unified page headers */
.page-head,
.page-hero,
.unified-page-head {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 18px !important;
    min-width: 0 !important;
    margin: 0 0 18px 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

.page-head-main,
.hero-main {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    min-width: 0 !important;
}

.page-title,
.page-head h1,
.page-hero h1 {
    font-size: 24px !important;
    line-height: 1.1 !important;
    font-weight: 900 !important;
    letter-spacing: -0.02em !important;
    text-transform: none !important;
}

.page-subtitle,
.hero-copy {
    margin: 0 !important;
    max-width: 78ch !important;
    font-size: 13px !important;
    line-height: 1.55 !important;
}

.eyebrow {
    display: none !important;
}

.page-actions,
.hero-actions,
.toolbar {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-end !important;
    align-content: flex-start !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    min-width: 220px !important;
}

.page-meta,
.hero-meta {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
    margin-top: 4px !important;
}

@media (max-width: 900px) {
    .page-head,
    .page-hero,
    .unified-page-head {
        flex-direction: column !important;
    }

    .page-actions,
    .hero-actions,
    .toolbar {
        min-width: 0 !important;
        justify-content: flex-start !important;
    }
}

/* no gradients */
body,
html, body {
    background: #020306 !important;
}

.card,
.panel,
.surface,
.modal .inner {
    background: rgba(15, 26, 46, 0.82) !important;
    background-image: none !important;
}

.btn.danger {
    background: rgba(239, 68, 68, 0.14) !important;
}

th,
td,
select,
input[type="text"],
input[type="search"],
input[type="number"],
textarea {
    background-image: none !important;
}
/* disable sticky shell on dashboard/market/news/sentiment */
body:has(.nav a[href='/dashboard'].active) > .layout > .sidebar,
body:has(.nav a[href='/market'].active) > .layout > .sidebar,
body:has(.nav a[href='/news'].active) > .layout > .sidebar,
body:has(.nav a[href='/sentiment'].active) > .layout > .sidebar {
    position: relative !important;
    top: auto !important;
    height: auto !important;
    overflow: visible !important;
}
body:has(.nav a[href='/dashboard'].active) > .layout > .content > .topbar,
body:has(.nav a[href='/market'].active) > .layout > .content > .topbar,
body:has(.nav a[href='/news'].active) > .layout > .content > .topbar,
body:has(.nav a[href='/sentiment'].active) > .layout > .content > .topbar {
    position: relative !important;
    top: auto !important;
}
/* disable sticky shell on dashboard/market/news/sentiment without :has */
body[data-path='/dashboard'] > .layout > .sidebar,
body[data-path='/market'] > .layout > .sidebar,
body[data-path='/news'] > .layout > .sidebar,
body[data-path='/sentiment'] > .layout > .sidebar {
    position: relative !important;
    top: auto !important;
    height: auto !important;
    overflow: visible !important;
}

body[data-path='/dashboard'] > .layout > .content > .topbar,
body[data-path='/market'] > .layout > .content > .topbar,
body[data-path='/news'] > .layout > .content > .topbar,
body[data-path='/sentiment'] > .layout > .content > .topbar {
    position: relative !important;
    top: auto !important;
}/* unified typography */
:root {
    --font-size-body: 14px;
    --line-height-body: 1.55;
    --font-size-page-title: 24px;
    --line-height-page-title: 1.1;
    --font-size-section-title: 14px;
    --line-height-section-title: 1.35;
    --font-size-subsection-title: 13px;
    --line-height-subsection-title: 1.4;
    --font-size-caption: 11px;
    --line-height-caption: 1.45;
}
body {
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
}
button,
input,
select,
textarea {
    font: inherit;
}
.small {
    font-size: var(--font-size-caption);
    line-height: var(--line-height-caption);
}
.card > .hd h2,
.panel > .hd h2,
.surface > .hd h2 {
    font-size: var(--font-size-section-title);
    line-height: var(--line-height-section-title);
    font-weight: 800;
    text-transform: none;
    letter-spacing: -0.01em;
}
.page-title,
.page-head h1,
.page-hero h1 {
    font-size: var(--font-size-page-title) !important;
    line-height: var(--line-height-page-title) !important;
}
.page-subtitle,
.hero-copy {
    font-size: var(--font-size-body) !important;
    line-height: var(--line-height-body) !important;
}
h3,
.card-title,
.modal-title {
    font-size: var(--font-size-subsection-title);
    line-height: var(--line-height-subsection-title);
    font-weight: 700;
    letter-spacing: -0.01em;
}
p,
li,
td,
.body,
.card-body,
.v,
.value,
.desc,
.msg .body {
    font-size: var(--font-size-body);
    line-height: var(--line-height-body);
}
label,
.muted,
.hint,
.sub,
.k,
th,
.tiny {
    line-height: var(--line-height-caption);
}

/* unified spacing */
:root {
    --space-1: 6px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 14px;
    --space-5: 18px;
    --space-6: 24px;
    --page-gap: var(--space-5);
    --section-gap: var(--space-4);
    --content-gap: var(--space-3);
    --title-gap: var(--space-1);
    --card-padding: var(--space-4);
    --card-header-padding-y: 12px;
    --card-header-padding-x: 14px;
}
.main,
.page-shell,
.dashboard-grid,
.market-grid,
.news-grid,
.sentiment-grid,
.logs-grid,
.ml-grid,
.chat-page,
.trading-page,
.portfolio-page,
.narratives-page {
    gap: var(--page-gap) !important;
}
.grid,
.page-grid,
.content-grid,
.stack,
.col,
.row-gap {
    gap: var(--section-gap) !important;
}
.page-head,
.page-hero,
.unified-page-head {
    margin-bottom: var(--page-gap) !important;
    gap: var(--page-gap) !important;
}
.page-head-main,
.hero-main {
    gap: var(--title-gap) !important;
}
.page-title,
.page-head h1,
.page-hero h1,
.card-title,
.card > .hd h2,
.panel > .hd h2,
.surface > .hd h2,
h3 {
    margin: 0 !important;
}
.page-subtitle,
.hero-copy,
.card-subtitle,
.metric-foot,
.hint,
.desc,
.k + .v,
.title + .desc {
    margin: 0 !important;
}
.card > .hd,
.panel > .hd,
.surface > .hd,
.modal .hd,
.card-head {
    gap: var(--content-gap) !important;
    padding: var(--card-header-padding-y) var(--card-header-padding-x) !important;
}
.card > .bd,
.panel > .bd,
.surface > .bd,
.card > .body,
.panel > .body,
.surface > .body,
.card-body,
.body {
    padding: var(--card-padding) !important;
}
.stack,
.body,
.card-body,
.panel > .body,
.surface > .body,
.kv,
.refs,
.ref-list,
.chip-list,
.filters,
.actions,
.toolbar,
.page-actions,
.hero-actions {
    gap: var(--content-gap) !important;
}
.row,
.chips,
.pager,
.statusline,
.chat-toolbar,
.thread-toolbar,
.chat-actions,
.thread-actions,
.composer-actions,
.top-left,
.top-right {
    gap: var(--space-2) !important;
}
.page-title + .page-subtitle,
.page-head h1 + .page-subtitle,
.page-head h1 + .hero-copy,
.page-hero h1 + .hero-copy,
.card-title + .card-subtitle,
h3 + p,
h2 + p {
    margin-top: var(--title-gap) !important;
}
/* merged: theme_ml_blocks.css */
:root {
  --ml-block-panel: rgba(15, 26, 46, 0.75);
  --ml-block-soft: rgba(12, 22, 41, 0.75);
  --ml-block-border: #1c2a44;
  --ml-block-text: #e6edf7;
  --ml-block-muted: #9fb0c8;
  --ml-block-accent: #7aa2ff;
  --ml-block-shadow: 0 10px 30px rgba(0,0,0,.25);
  --ml-block-radius: 14px;
}

.page-title,
.page-hero h1,
.page-head h1 {
  color: var(--ml-block-text) !important;
}

.page-subtitle,
.hero-copy,
.card-subtitle,
.hint,
.muted,
.small,
label,
.metric-foot,
.sub,
.k,
.ref .k {
  color: var(--ml-block-muted) !important;
}

.btn,
button.btn,
a.btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  min-height: 34px !important;
  padding: 9px 12px !important;
  border-radius: 12px !important;
  border: 1px solid rgba(122,162,255,.35) !important;
  background: rgba(122,162,255,.12) !important;
  color: var(--ml-block-text) !important;
  font-size: 13px !important;
  box-shadow: none !important;
}

.btn:hover,
button.btn:hover,
a.btn:hover {
  background: rgba(122,162,255,.18) !important;
  border-color: rgba(122,162,255,.35) !important;
  box-shadow: none !important;
}

.btn.secondary,
button.btn.secondary,
a.btn.secondary {
  border-color: var(--ml-block-border) !important;
  background: rgba(12,22,41,.7) !important;
  color: var(--ml-block-muted) !important;
}

.chip,
.pill,
.tag,
.badge,
.trace-chip,
.ref-chip,
.raw-chip,
.json-chip {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  min-height: 26px !important;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  background: rgba(12,22,41,.7) !important;
  border: 1px solid var(--ml-block-border) !important;
  color: var(--ml-block-muted) !important;
  font-size: 12px !important;
  box-shadow: none !important;
}

.ctrl,
.ctl,
.control-group,
.metric,
.box,
.summary-box,
.ref,
.ref-item,
.empty,
.empty-state,
.json-box,
.narrative-item,
.evidence-item {
  background: var(--ml-block-soft) !important;
  border: 1px solid var(--ml-block-border) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}

.card,
.panel,
.surface,
.agent-card,
.block,
.step,
.diff,
.modal .inner,
.modal {
  background: var(--ml-block-panel) !important;
  border: 1px solid var(--ml-block-border) !important;
  border-radius: var(--ml-block-radius) !important;
  backdrop-filter: blur(10px) !important;
  box-shadow: var(--ml-block-shadow) !important;
}

.card::before,
.panel::before,
.surface::before,
.agent-card::before,
.block::before,
.step::before,
.diff::before {
  display: none !important;
}

.card > .hd,
.panel > .hd,
.surface > .hd,
.modal .hd,
.card-head {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  min-height: 56px !important;
  padding: 12px 14px !important;
  border-bottom: 1px solid var(--ml-block-border) !important;
  background: transparent !important;
  box-shadow: none !important;
}

.card > .hd h2,
.panel > .hd h2,
.surface > .hd h2,
.card-title {
  margin: 0 !important;
  color: rgba(230,237,247,.92) !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  letter-spacing: .045em !important;
}

.card > .bd,
.panel > .bd,
.surface > .bd,
.card > .body,
.panel > .body,
.surface > .body,
.card-body,
.body {
  padding: 12px 14px !important;
  min-width: 0 !important;
}

.table-wrap table,
.card table,
.panel table,
.surface table,
table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 8px !important;
}

.table-wrap th,
.table-wrap td,
.card th,
.card td,
.panel th,
.panel td,
.surface th,
.surface td,
th,
td {
  text-align: left !important;
}

th {
  padding: 0 8px !important;
  color: rgba(159,176,200,.75) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: .12em !important;
  text-transform: uppercase !important;
}

td {
  padding: 10px 8px !important;
  background: rgba(12,22,41,.75) !important;
  border-top: 1px solid rgba(28,42,68,.9) !important;
  border-bottom: 1px solid rgba(28,42,68,.9) !important;
  vertical-align: top !important;
}

tr td:first-child {
  border-left: 1px solid rgba(28,42,68,.9) !important;
  border-top-left-radius: 12px !important;
  border-bottom-left-radius: 12px !important;
}

tr td:last-child {
  border-right: 1px solid rgba(28,42,68,.9) !important;
  border-top-right-radius: 12px !important;
  border-bottom-right-radius: 12px !important;
}

/* no gradients */
.card,
.panel,
.surface,
.agent-card,
.block,
.step,
.diff,
.metric,
.box,
.summary-box,
.ref,
.ref-item,
.empty,
.empty-state,
.json-box,
.narrative-item,
.evidence-item {
    background-image: none !important;
}

/* global shell sidebar unification */
body > .layout > .sidebar {
  background: linear-gradient(180deg, rgba(10, 20, 38, 0.96), rgba(7, 14, 30, 0.96)) !important;
  border-right: 1px solid rgba(147, 197, 253, 0.10) !important;
  padding: 16px 14px !important;
  position: sticky !important;
  top: 0 !important;
  height: 100vh !important;
  overflow: auto !important;
  backdrop-filter: none !important;
}

body > .layout > .sidebar .brand {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  margin-bottom: 14px !important;
  padding: 12px !important;
  border: 1px solid rgba(147, 197, 253, 0.10) !important;
  border-radius: 18px !important;
  background: rgba(12, 22, 41, 0.72) !important;
  box-shadow: var(--ml-block-shadow) !important;
}

body > .layout > .sidebar .logo {
  width: 40px !important;
  height: 40px !important;
  flex: 0 0 auto !important;
  border-radius: 14px !important;
  background: radial-gradient(circle at 30% 30%, #7aa2ff, transparent 60%), radial-gradient(circle at 72% 62%, #38bdf8, transparent 62%), #08101f !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.30) !important;
}

body > .layout > .sidebar .brand h1 {
  margin: 0 !important;
  font-size: 14px !important;
  line-height: 1.1 !important;
  font-weight: 900 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  color: #f3f4f6 !important;
}

body > .layout > .sidebar .brand .sub {
  margin-top: 4px !important;
  font-size: 11px !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  color: var(--ml-block-muted) !important;
}

body > .layout > .sidebar .nav {
  display: grid !important;
  gap: 8px !important;
  margin-top: 10px !important;
}

body > .layout > .sidebar .nav a {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  min-height: 42px !important;
  padding: 10px 12px !important;
  border-radius: 14px !important;
  color: var(--ml-block-text) !important;
  background: rgba(255, 255, 255, 0.01) !important;
  border: 1px solid transparent !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

body > .layout > .sidebar .nav a:hover {
  color: var(--ml-block-text) !important;
  background: rgba(122, 162, 255, 0.08) !important;
  border-color: rgba(122, 162, 255, 0.25) !important;
  text-decoration: none !important;
}

body > .layout > .sidebar .nav a:focus,
body > .layout > .sidebar .nav a:active,
body > .layout > .sidebar .nav a:visited {
  text-decoration: none !important;
}

body > .layout > .sidebar .nav a.active {
  background: rgba(122, 162, 255, 0.12) !important;
  border-color: rgba(122, 162, 255, 0.35) !important;
  color: var(--ml-block-text) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
}/* unified typography overrides */
.page-title,
.page-hero h1,
.page-head h1 {
  font-size: var(--font-size-page-title) !important;
  line-height: var(--line-height-page-title) !important;
}
.page-subtitle,
.hero-copy,
.card-body,
.body,
p,
li,
td,
.msg .body {
  font-size: var(--font-size-body) !important;
  line-height: var(--line-height-body) !important;
}
.card > .hd h2,
.panel > .hd h2,
.surface > .hd h2,
.card-title {
  font-size: var(--font-size-section-title) !important;
  line-height: var(--line-height-section-title) !important;
  font-weight: 800 !important;
  text-transform: none !important;
  letter-spacing: -0.01em !important;
}
h3,
.modal-title,
.agent-card .title h3 {
  font-size: var(--font-size-subsection-title) !important;
  line-height: var(--line-height-subsection-title) !important;
  letter-spacing: -0.01em !important;
}
label,
.muted,
.small,
.hint,
.metric-foot,
.sub,
.k,
.ref .k,
th,
.tiny {
  line-height: var(--line-height-caption) !important;
}
/* unified spacing overrides */
.page-head,
.page-hero,
.unified-page-head {
  margin-bottom: var(--page-gap) !important;
  gap: var(--page-gap) !important;
}
.page-head-main,
.hero-main,
.stack,
.body,
.card-body,
.panel > .body,
.surface > .body,
.kv,
.refs,
.filters,
.actions,
.toolbar,
.page-actions,
.hero-actions {
  gap: var(--content-gap) !important;
}
.card > .hd,
.panel > .hd,
.surface > .hd,
.modal .hd,
.card-head {
  gap: var(--content-gap) !important;
  padding: var(--card-header-padding-y) var(--card-header-padding-x) !important;
}
.card > .bd,
.panel > .bd,
.surface > .bd,
.card > .body,
.panel > .body,
.surface > .body,
.card-body,
.body {
  padding: var(--card-padding) !important;
}
.page-title,
.page-head h1,
.page-hero h1,
.card-title,
.card > .hd h2,
.panel > .hd h2,
.surface > .hd h2,
h3 {
  margin: 0 !important;
}
.page-subtitle,
.hero-copy,
.card-subtitle,
.metric-foot,
.hint,
.desc {
  margin: 0 !important;
}
.page-title + .page-subtitle,
.page-head h1 + .page-subtitle,
.page-head h1 + .hero-copy,
.page-hero h1 + .hero-copy,
.card-title + .card-subtitle,
h3 + p,
h2 + p {
  margin-top: var(--title-gap) !important;
}

/* merged note: theme_ml_global.css was not referenced by templates at merge time.
   Its rules are preserved below for audit only and intentionally commented out
   so the live UI does not change unexpectedly. */
/*
:root {
    --ml-bg: #081022;
    --ml-bg-soft: #0b1220;
    --ml-panel: rgba(15, 26, 46, 0.75);
    --ml-panel-soft: rgba(12, 22, 41, 0.75);
    --ml-border: #1c2a44;
    --ml-text: #e6edf7;
    --ml-muted: #9fb0c8;
    --ml-accent: #7aa2ff;
    --ml-good: #4ade80;
    --ml-warn: #fbbf24;
    --ml-bad: #fb7185;
    --ml-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    --ml-radius: 14px;
}

html,
body {
    background: linear-gradient(180deg, #081022 0%, #070d18 100%) !important;
    color: var(--ml-text) !important;
}

* { box-sizing: border-box; }
:where(main, section, article, aside, div, header, footer) { min-width: 0; }

.layout { background: transparent !important; }
.content, .main { min-width: 0; }
.main { display: flex; flex-direction: column; gap: 16px; }

.sidebar {
    background: rgba(10, 18, 34, 0.7) !important;
    backdrop-filter: blur(10px) !important;
    border-right: 1px solid var(--ml-border) !important;
}

.brand {
    background: transparent !important;
    border-bottom: 1px solid var(--ml-border) !important;
    box-shadow: none !important;
}

.logo {
    border: 0 !important;
    box-shadow: var(--ml-shadow) !important;
}

.nav a {
    color: var(--ml-muted) !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
}

.nav a:hover {
    color: var(--ml-text) !important;
    background: rgba(122, 162, 255, 0.08) !important;
    border-color: rgba(122, 162, 255, 0.25) !important;
}

.nav a.active {
    color: var(--ml-text) !important;
    background: rgba(122, 162, 255, 0.12) !important;
    border-color: rgba(122, 162, 255, 0.35) !important;
}

.topbar,
.page-head,
.page-hero {
    background: var(--ml-panel) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid var(--ml-border) !important;
    border-radius: var(--ml-radius) !important;
    box-shadow: var(--ml-shadow) !important;
}

.ctl,
.ctrl,
.control-group {
    background: rgba(12, 22, 41, 0.7) !important;
    border: 1px solid var(--ml-border) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
}

.btn,
button.btn,
a.btn {
    color: var(--ml-text) !important;
    border: 1px solid rgba(122, 162, 255, 0.35) !important;
    background: rgba(122, 162, 255, 0.12) !important;
    box-shadow: none !important;
}

.btn:hover,
button.btn:hover,
a.btn:hover {
    background: rgba(122, 162, 255, 0.18) !important;
}

.btn.secondary,
button.btn.secondary,
a.btn.secondary {
    color: var(--ml-muted) !important;
    border-color: var(--ml-border) !important;
    background: rgba(12, 22, 41, 0.7) !important;
}

.pill,
.chip,
.tag,
.badge,
.trace-chip,
.ref-chip,
.raw-chip,
.json-chip,
.env-badge,
.watch-chip,
.alert-chip {
    color: var(--ml-muted) !important;
    background: rgba(12, 22, 41, 0.7) !important;
    border: 1px solid var(--ml-border) !important;
    box-shadow: none !important;
}

.card,
.panel,
.surface,
.metric,
.box,
.summary-box,
.narrative-item,
.evidence-item,
.empty,
.empty-state,
.map-box,
.quote,
.ref,
.ref-item,
.json-box,
.modal .inner,
.inner {
    min-width: 0 !important;
    background: var(--ml-panel) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid var(--ml-border) !important;
    border-radius: var(--ml-radius) !important;
    box-shadow: var(--ml-shadow) !important;
}

.card::before,
.panel::before,
.surface::before {
    display: none !important;
}

.card-head,
.card .hd,
.hd,
.panel-head,
.modal .hd {
    min-height: 0 !important;
    padding: 12px 14px !important;
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    box-shadow: none !important;
}

.card-body,
.card .bd,
.body {
    padding: 14px !important;
    background: transparent !important;
}

.page-title {
    margin: 0 0 14px !important;
    color: var(--ml-text) !important;
    font-size: 18px !important;
    line-height: 1.1 !important;
    font-weight: 900 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
}

.page-subtitle,
.card-subtitle,
.hint,
.muted,
.small,
label,
th,
.metric-foot,
.sub {
    color: var(--ml-muted) !important;
}

.metric,
.box,
.summary-box,
.narrative-item,
.evidence-item,
.ref,
.json-box {
    background: var(--ml-panel-soft) !important;
    border: 1px solid rgba(28, 42, 68, 0.9) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
}

.metric-label,
.k,
.ref .k {
    color: var(--ml-muted) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}

.metric-value,
.val {
    color: var(--ml-text) !important;
    font-size: 28px !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em !important;
}

table,
.table {
    width: 100%;
}

.table-wrap table,
.card table,
.panel table,
.surface table {
    border-collapse: separate !important;
    border-spacing: 0 8px !important;
}

.table-wrap th,
.card th,
.panel th,
.surface th {
    color: rgba(159, 176, 200, 0.75) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.12em !important;
    padding: 0 8px !important;
}

.table-wrap td,
.card td,
.panel td,
.surface td {
    background: rgba(12, 22, 41, 0.75) !important;
    border-top: 1px solid rgba(28, 42, 68, 0.9) !important;
    border-bottom: 1px solid rgba(28, 42, 68, 0.9) !important;
    padding: 10px 8px !important;
    vertical-align: top !important;
}

.table-wrap tr td:first-child,
.card tr td:first-child,
.panel tr td:first-child,
.surface tr td:first-child {
    border-left: 1px solid rgba(28, 42, 68, 0.9) !important;
    border-top-left-radius: 12px !important;
    border-bottom-left-radius: 12px !important;
}

.table-wrap tr td:last-child,
.card tr td:last-child,
.panel tr td:last-child,
.surface tr td:last-child {
    border-right: 1px solid rgba(28, 42, 68, 0.9) !important;
    border-top-right-radius: 12px !important;
    border-bottom-right-radius: 12px !important;
}

.empty,
.empty-state {
    color: var(--ml-muted) !important;
    background: rgba(12, 22, 41, 0.45) !important;
    border: 1px dashed rgba(28, 42, 68, 0.9) !important;
}

/* shell lock: keep sidebar/topbar/logo identical on all pages */
body > .layout {
    display: grid !important;
    grid-template-columns: var(--v-sidebar-w) minmax(0, 1fr) !important;
    min-height: 100vh !important;
}

body > .layout > .sidebar {
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
    overflow: auto !important;
    padding: 16px 14px !important;
    background: linear-gradient(180deg, rgba(10, 20, 38, 0.96), rgba(7, 14, 30, 0.96)) !important;
    border-right: 1px solid var(--ml-border) !important;
    backdrop-filter: none !important;
}

body > .layout > .sidebar .brand {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 14px !important;
    padding: 12px !important;
    border: 1px solid rgba(147, 197, 253, 0.10) !important;
    border-radius: 18px !important;
    background: rgba(12, 22, 41, 0.72) !important;
    box-shadow: var(--ml-shadow) !important;
}

body > .layout > .sidebar .logo {
    width: 40px !important;
    height: 40px !important;
    flex: 0 0 auto !important;
    border-radius: 14px !important;
    background: radial-gradient(circle at 30% 30%, #7aa2ff, transparent 60%), radial-gradient(circle at 72% 62%, #38bdf8, transparent 62%), #08101f !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.30) !important;
}

body > .layout > .sidebar .brand h1 {
    margin: 0 !important;
    font-size: 14px !important;
    line-height: 1.1 !important;
    font-weight: 900 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
    color: #f3f4f6 !important;
}

body > .layout > .sidebar .brand .sub {
    margin-top: 4px !important;
    font-size: 11px !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    color: var(--ml-muted) !important;
}

body > .layout > .sidebar .nav {
    display: grid !important;
    gap: 8px !important;
}

body > .layout > .sidebar .nav a {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-height: 42px !important;
    padding: 10px 12px !important;
    border-radius: 14px !important;
    color: var(--ml-text) !important;
    background: rgba(255, 255, 255, 0.01) !important;
    border: 1px solid transparent !important;
    transform: none !important;
}


body > .layout > .sidebar .nav a:hover {
    color: var(--ml-text) !important;
    background: rgba(122, 162, 255, 0.08) !important;
    border-color: rgba(122, 162, 255, 0.25) !important;
    text-decoration: none !important;
}

body > .layout > .sidebar .nav a:focus,
body > .layout > .sidebar .nav a:active,
body > .layout > .sidebar .nav a:visited {
    text-decoration: none !important;
}

body > .layout > .sidebar .nav a.active {
    background: rgba(122, 162, 255, 0.12) !important;
    border-color: rgba(122, 162, 255, 0.35) !important;
    color: var(--ml-text) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
}
body > .layout > .sidebar .nav-ico {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 18px !important;
    min-width: 18px !important;
    height: 18px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    color: #bfdbfe !important;
    opacity: 0.95 !important;
}

body > .layout > .content {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
}

body > .layout > .content > .topbar {
    position: relative !important;
    top: 0 !important;
    width: calc(100% - 36px) !important;
    max-width: calc(100vw - 36px) !important;
    margin: 0 auto !important;
    padding: 12px 16px !important;
    border-radius: 18px !important;
}

body > .layout > .content > .main {
    padding: 16px 18px 28px !important;
    min-width: 0 !important;
}

/* =============================================================================
   Vanga shell: collapsible sidebar, darker surfaces, mobile drawer
   ============================================================================= */

:root {
    --v-shell-bg: #020306;
    --v-shell-bg-elev: #060b14;
    --v-shell-panel: rgba(8, 14, 26, 0.92);
}

.vanga-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
}

.sidebar-overlay[hidden] {
    display: none !important;
}

.shell-mobile-bar {
    display: none;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 8px 12px 8px max(12px, env(safe-area-inset-left));
    margin: 0 12px 10px max(12px, env(safe-area-inset-right));
    border-radius: 16px;
    border: 1px solid rgba(147, 197, 253, 0.12);
    background: var(--v-shell-panel);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.shell-mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 14px;
    border: 1px solid rgba(122, 162, 255, 0.28);
    background: rgba(122, 162, 255, 0.1);
    color: #e2e8f0;
    cursor: pointer;
    flex-shrink: 0;
}

.shell-mobile-menu-btn:hover {
    background: rgba(122, 162, 255, 0.16);
}

.shell-mobile-menu-icon {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    box-shadow:
        0 -6px 0 currentColor,
        0 6px 0 currentColor;
}

.shell-mobile-brand {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #f1f5f9;
}

/* Brand row + SVG logo */
body > .layout > .sidebar .brand {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    position: relative !important;
}

body > .layout > .sidebar .brand-dashboard-link {
    display: flex !important;
    align-items: center !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    text-decoration: none !important;
    color: inherit !important;
}

body > .layout > .sidebar .brand-dashboard-link:hover {
    text-decoration: none !important;
}

body > .layout > .sidebar .logo {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    flex-shrink: 0 !important;
    border-radius: 14px !important;
    background: linear-gradient(145deg, rgba(12, 22, 41, 0.95), rgba(4, 8, 18, 0.98)) !important;
    border: 1px solid rgba(147, 197, 253, 0.14) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 4px !important;
}

body > .layout > .sidebar .logo-svg {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

body > .layout > .sidebar .brand .brand-text h1 {
    margin: 0 !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em !important;
    text-transform: none !important;
    color: #f8fafc !important;
}

body > .layout > .sidebar .brand .sub {
    display: none !important;
}

/* Desktop: collapse/expand by clicking the logo (no visible arrow) */
.sidebar-logo-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 14px !important;
    background: transparent !important;
    color: inherit !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-logo-toggle:focus-visible {
    outline: 2px solid rgba(96, 165, 250, 0.55) !important;
    outline-offset: 2px !important;
}

.sidebar-logo-toggle:hover .logo {
    border-color: rgba(122, 162, 255, 0.35) !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45) !important;
}

body > .layout > .sidebar .nav a .nav-ico {
    flex: 0 0 auto !important;
    width: 1.35em !important;
    text-align: center !important;
    font-size: 1.05em !important;
    line-height: 1 !important;
}

body > .layout > .sidebar .nav a .nav-text {
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

html.v-sidebar-collapsed:not(.v-sidebar-mobile-open) body > .layout > .sidebar .brand-dashboard-link {
    display: none !important;
}

html.v-sidebar-collapsed:not(.v-sidebar-mobile-open) body > .layout > .sidebar .brand {
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 10px !important;
}

html.v-sidebar-collapsed:not(.v-sidebar-mobile-open) body > .layout > .sidebar .nav a {
    justify-content: center !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
}

html.v-sidebar-collapsed:not(.v-sidebar-mobile-open) body > .layout > .sidebar .nav a .nav-text {
    display: none !important;
}

/* Desktop grid width follows --v-sidebar-w */
@media (min-width: 1025px) {
    body > .layout {
        grid-template-columns: var(--v-sidebar-w) minmax(0, 1fr) !important;
    }

    body > .layout > .sidebar {
        grid-column: 1 !important;
        width: var(--v-sidebar-w) !important;
        min-width: var(--v-sidebar-w) !important;
        max-width: var(--v-sidebar-w) !important;
    }

    body > .layout > .content {
        grid-column: 2 !important;
        min-width: 0 !important;
    }
}

/* Mobile / tablet: drawer */
@media (max-width: 1024px) {
    .shell-mobile-bar {
        display: flex !important;
    }

    body > .layout {
        grid-template-columns: 1fr !important;
    }

    body > .layout > .sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: min(300px, calc(100vw - 48px)) !important;
        min-width: 0 !important;
        max-width: min(300px, calc(100vw - 48px)) !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        z-index: 95 !important;
        transform: translate3d(-105%, 0, 0) !important;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: 12px 0 48px rgba(0, 0, 0, 0.45) !important;
        border-right: 1px solid rgba(147, 197, 253, 0.12) !important;
        padding-top: max(16px, env(safe-area-inset-top)) !important;
        padding-bottom: max(16px, env(safe-area-inset-bottom)) !important;
    }

    html.v-sidebar-mobile-open body > .layout > .sidebar {
        transform: translate3d(0, 0, 0) !important;
    }

    /* Beat path-specific “relative sidebar” locks on small screens */
    body[data-path='/dashboard'] > .layout > .sidebar,
    body[data-path='/market'] > .layout > .sidebar,
    body[data-path='/news'] > .layout > .sidebar,
    body[data-path='/sentiment'] > .layout > .sidebar,
    body:has(.nav a[href='/dashboard'].active) > .layout > .sidebar,
    body:has(.nav a[href='/market'].active) > .layout > .sidebar,
    body:has(.nav a[href='/news'].active) > .layout > .sidebar,
    body:has(.nav a[href='/sentiment'].active) > .layout > .sidebar {
        position: fixed !important;
        top: 0 !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        overflow: auto !important;
    }

    .sidebar-logo-toggle {
        pointer-events: auto !important;
    }

    body > .layout > .sidebar .brand-text,
    body > .layout > .sidebar .nav a .nav-text {
        display: inline !important;
    }

    /* Always show labels on small screens even if desktop collapse was stored */
    html.v-sidebar-collapsed body > .layout > .sidebar .nav a .nav-text {
        display: inline !important;
    }

    html.v-sidebar-collapsed body > .layout > .sidebar .brand-text {
        display: block !important;
    }

    body > .layout > .sidebar .nav a {
        justify-content: flex-start !important;
    }

    body > .layout > .content > .app-topbar,
    body > .layout > .content > header.app-topbar {
        width: auto !important;
        max-width: none !important;
        margin-left: max(10px, env(safe-area-inset-left)) !important;
        margin-right: max(10px, env(safe-area-inset-right)) !important;
    }

    body > .layout > .content > .main {
        padding: 10px max(12px, env(safe-area-inset-left)) 24px max(12px, env(safe-area-inset-right)) !important;
    }
}

@media (max-width: 520px) {
    .page-title,
    .page-head h1,
    .page-hero h1 {
        font-size: clamp(1.15rem, 5vw, 1.35rem) !important;
    }

    .app-topbar__pill,
    .app-topbar__status-pill {
        font-size: 10px !important;
    }

    .app-topbar__control {
        width: 100% !important;
        flex-wrap: wrap !important;
    }

    .app-topbar__control select {
        width: 100% !important;
        min-width: 0 !important;
    }
}

/* Darker cards / shell (override merged ML theme slightly) */
.card,
.panel,
.surface,
.modal .inner {
    background: rgba(6, 12, 24, 0.88) !important;
}

body > .layout > .sidebar {
    background: linear-gradient(195deg, rgba(6, 12, 24, 0.98) 0%, rgba(2, 5, 12, 0.99) 100%) !important;
}

.app-topbar {
    background: rgba(4, 9, 18, 0.92) !important;
}

/* Win over any remaining shell locks: sidebar width follows html.v-sidebar-collapsed */
@media (min-width: 1025px) {
    html body > .layout {
        grid-template-columns: var(--v-sidebar-w) minmax(0, 1fr) !important;
    }

    html body > .layout > .sidebar {
        grid-column: 1 !important;
        width: var(--v-sidebar-w) !important;
        min-width: var(--v-sidebar-w) !important;
        max-width: var(--v-sidebar-w) !important;
        box-sizing: border-box !important;
    }

    html body > .layout > .content {
        grid-column: 2 !important;
        min-width: 0 !important;
    }
}
