:root {
  --bg: #080c12;
  --surface: #111a27;
  --surface-2: #162131;
  --border: #2a384b;
  --text: #edf2f9;
  --muted: #a8b5c8;
  --success: #45d68a;
  --danger: #ff6577;
  --warning: #ffd166;
  --sidebar-width: 248px;
}

html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); letter-spacing: 0; overflow-x: hidden; }
h1, h2, h3, h4, h5 { letter-spacing: 0; }
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 1040; width: var(--sidebar-width);
  padding: 1rem; overflow-y: auto; background: #0e1622; border-right: 1px solid var(--border);
  transition: transform .2s ease;
}
.sidebar-brand { padding: .4rem .75rem 1rem; font-weight: 700; }
.sidebar-nav { display: grid; gap: .2rem; }
.sidebar a { color: var(--muted); text-decoration: none; padding: .65rem .75rem; border-radius: 6px; }
.sidebar a:hover, .sidebar a.active { background: var(--surface-2); color: #fff; }
.sidebar-overlay { display: none; position: fixed; inset: 0; z-index: 1030; background: rgba(0, 0, 0, .58); }
.mobile-bar { display: none; position: sticky; top: 0; z-index: 1020; padding: .65rem 1rem; background: #0e1622; border-bottom: 1px solid var(--border); }
.menu-button { width: 42px; height: 38px; padding: 0; display: inline-grid; place-items: center; }
.menu-icon, .menu-icon::before, .menu-icon::after { width: 18px; height: 2px; display: block; background: currentColor; content: ""; }
.menu-icon { position: relative; }
.menu-icon::before { position: absolute; top: -6px; }
.menu-icon::after { position: absolute; top: 6px; }
.content { min-width: 0; margin-left: var(--sidebar-width); padding: 1.5rem; }
.content-inner { width: 100%; max-width: 1900px; margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-header h2 { margin: 0; font-size: 1.55rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 1.5rem 0 .75rem; }
.section-header h4, .section-header h5 { margin: 0; }

.metric, .panel {
  min-width: 0; height: auto; padding: 1rem; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
}
.metric .label, .field-label { color: var(--muted); font-size: .82rem; }
.metric .value { margin-top: .15rem; font-size: 1.35rem; font-weight: 700; overflow-wrap: anywhere; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.metric-grid.compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }
.empty-state { width: 100%; padding: .9rem 1rem; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: 8px; }
.info-collapsible-toggle {
  display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left;
  background: none; border: none; padding: 0; margin: 0; color: inherit; font-weight: 600;
  font-size: .95rem; cursor: pointer;
}
.info-collapsible-toggle:hover { color: var(--warning); }
.info-collapsible-caret { display: inline-block; font-size: .7rem; transition: transform .15s ease; }
.info-collapsible-toggle[aria-expanded="true"] .info-collapsible-caret { transform: rotate(90deg); }
.info-collapsible-body { padding-top: .9rem; }
.info-collapsible-body p:last-child { margin-bottom: 0 !important; }
.profit { color: var(--success) !important; }
.loss { color: var(--danger) !important; }
.warn { color: var(--warning) !important; }
.table-responsive { border: 1px solid var(--border); border-radius: 8px; }
.table { margin: 0; font-size: .9rem; --bs-table-bg: var(--surface); --bs-table-border-color: var(--border); }
.table-strategies { min-width: 1950px; }
.table-instruments { min-width: 1300px; }
@media (max-width: 767.98px) {
  .table-strategies, .table-instruments { min-width: 0; }
}
.table thead th { position: sticky; top: 0; z-index: 2; color: #dce5f2; background: #182436; white-space: nowrap; }
.table tbody tr:nth-child(even) > * { --bs-table-bg-type: rgba(255, 255, 255, .018); }
.table td { vertical-align: middle; overflow-wrap: anywhere; }
.table code { color: #b9d4ff; white-space: pre-wrap; }
.btn { white-space: normal; }
.form-control, .form-select { min-width: 0; }
.filter-form { padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.filter-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)) auto; align-items: end; gap: .75rem; }
.login-shell { min-height: calc(100vh - 3rem); display: grid; place-items: center; padding: 1rem 0; }
.login-panel { width: min(100%, 420px); }
.trade-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.trade-card { padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.trade-card-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .25rem; }
.trade-card-strategy { color: var(--muted); font-size: .78rem; margin-bottom: .6rem; }
.trade-card-figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-bottom: .6rem; }
.trade-card-figures .label { color: var(--muted); font-size: .72rem; }
.trade-card-figures .value { font-size: .95rem; font-weight: 600; }
.trade-chart-wrap { position: relative; width: 100%; height: 100px; }
/* Today's Highlights (live dashboard, AI Origination) */
.highlights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.vs-card { padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.vs-card-header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.vs-card-index { font-weight: 600; }
.vs-card-record { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.vs-bar-track { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: .6rem; }
.vs-bar-fill { height: 100%; border-radius: 4px; transition: width .3s ease; }
.vs-bar-fill.profit { background: var(--success); }
.vs-bar-fill.loss { background: var(--danger); }

.funnel-row { display: flex; align-items: stretch; flex-wrap: wrap; gap: .5rem; }
.funnel-chip { flex: 1; min-width: 100px; padding: .7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; text-align: center; }
.funnel-value { font-size: 1.4rem; font-weight: 700; }
.funnel-label { color: var(--muted); font-size: .72rem; margin-top: .15rem; }
.funnel-arrow { display: flex; align-items: center; color: var(--muted); font-size: 1.2rem; padding: 0 .1rem; }

.highlight-card {
  padding: 1rem 1rem 1rem 1.25rem; background: var(--surface); border: 1px solid var(--border);
  border-left-width: 4px; border-radius: 8px;
}
.highlight-card.accent-profit { border-left-color: var(--success); }
.highlight-card.accent-loss { border-left-color: var(--danger); }
.highlight-card.accent-neutral { border-left-color: var(--muted); }
.highlight-card blockquote { margin: .6rem 0 0; padding: 0; font-style: italic; color: var(--text); font-size: .92rem; line-height: 1.5; }

.near-miss-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.near-miss-chip {
  padding: .4rem .75rem; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; font-size: .8rem; cursor: help;
}

@media (max-width: 1399.98px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1199.98px) {
  .sidebar { transform: translateX(-100%); box-shadow: 12px 0 36px rgba(0, 0, 0, .35); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; }
  .mobile-bar { display: flex; align-items: center; gap: .75rem; }
  .content { margin-left: 0; padding: 1.25rem; }
}
@media (max-width: 991.98px) {
  .metric-grid, .metric-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
  .content { padding: 1rem; }
  .page-header, .section-header { align-items: flex-start; }
  .page-header { flex-wrap: wrap; }
  .form-grid, .filter-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .form-actions .btn, .filter-grid .btn { width: 100%; }
  .responsive-table { border: 0; overflow: visible; }
  .responsive-table table, .responsive-table tbody { display: block; }
  .responsive-table thead { display: none; }
  .responsive-table tbody tr { display: grid; gap: .5rem; margin-bottom: .75rem; padding: .9rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
  .responsive-table tbody td { display: grid; grid-template-columns: minmax(110px, 42%) minmax(0, 1fr); gap: .75rem; padding: .2rem 0; border: 0; text-align: right; }
  .responsive-table tbody td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; text-align: left; }
  .responsive-table tbody td[colspan] { display: block; text-align: left; }
  .responsive-table tbody td[colspan]::before { display: none; }
  .responsive-table .detail-row { margin-top: -.75rem; }
  .responsive-table input, .responsive-table select, .responsive-table button { width: 100%; }
}
@media (max-width: 639.98px) {
  .metric-grid, .metric-grid.compact, .detail-grid { grid-template-columns: 1fr; }
  .mobile-bar-title { max-width: calc(100vw - 80px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

