:root {
  --bg: #0d1014;
  --bg-elevated: #12161c;
  --bg-panel: #151a21;
  --bg-panel-2: #171d25;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f6f8;
  --text-soft: #abb4c0;
  --text-dim: #7e8997;
  --accent: #96a8ff;
  --green: #6ce0a2;
  --red: #ff6b73;
  --amber: #e0b66c;
  --radius-sm: 12px;
  --radius-md: 18px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  --sans: "SF Pro Display", "Segoe UI", "Helvetica Neue", "Arial Nova", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "IBM Plex Mono", "Roboto Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.045), transparent 28%),
    radial-gradient(circle at top right, rgba(150, 168, 255, 0.04), transparent 24%),
    linear-gradient(180deg, #0f1318 0%, #0c0f13 100%);
  color: var(--text);
  font-family: var(--sans);
}

body {
  min-height: 100vh;
  position: relative;
}

[hidden] {
  display: none !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 120px 120px;
  mask-image: radial-gradient(circle at center, black 24%, transparent 85%);
  opacity: 0.35;
}

button,
input,
select,
textarea {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.shell {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  height: 100vh;
  padding: 1.2rem;
  background: linear-gradient(180deg, rgba(12, 15, 19, 0.95), rgba(12, 15, 19, 0.88));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  padding: 0.55rem 0.6rem;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.012)),
    rgba(255, 255, 255, 0.02);
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.brand:hover {
  border-color: var(--border-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.018)),
    rgba(255, 255, 255, 0.024);
}

.brand:focus-visible {
  outline: none;
  border-color: rgba(150, 168, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(150, 168, 255, 0.12);
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1), transparent 54%),
    linear-gradient(180deg, #171d24 0%, #0f1318 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-mark img {
  width: 72%;
  height: 72%;
  object-fit: contain;
  filter: invert(1) contrast(1.08) brightness(1.02);
  mix-blend-mode: screen;
  opacity: 0.96;
}

.brand h1,
.topbar h2,
.panel h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: rgba(126, 137, 151, 0.84);
  font-size: 0.69rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 0.45rem;
}

.nav-item {
  display: grid;
  gap: 0.18rem;
  padding: 0.9rem 1rem;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item span {
  color: var(--text);
  font-weight: 600;
}

.nav-item small {
  color: var(--text-dim);
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(150, 168, 255, 0.16);
  transform: translateX(2px);
}

.sidebar-card,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.024), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, rgba(21, 26, 33, 0.96), rgba(18, 22, 28, 0.94));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.sidebar-card {
  margin-top: auto;
  padding: 1rem;
}

.sidebar-metric {
  display: grid;
  gap: 0.25rem;
}

.sidebar-metric span,
.muted,
.panel p,
.profile small,
.recommendation-meta,
.settings-row p,
.quality-list {
  color: var(--text-soft);
}

.mini-bars {
  display: flex;
  align-items: end;
  gap: 0.4rem;
  height: 70px;
  margin-top: 1rem;
}

.mini-bars span {
  flex: 1;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, rgba(108, 224, 162, 0.9), rgba(108, 224, 162, 0.25));
}

.mini-bars span.negative {
  background: linear-gradient(180deg, rgba(255, 107, 115, 0.85), rgba(255, 107, 115, 0.25));
}

.main {
  padding: 1.1rem;
  position: relative;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.88rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.008)),
    rgba(18, 22, 28, 0.88);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(18px);
}

.auth-empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.05rem 1.1rem;
  border-style: solid;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, rgba(21, 26, 33, 0.96), rgba(18, 22, 28, 0.94));
}

.auth-gate {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.25rem;
  background:
    radial-gradient(circle at top right, rgba(150, 168, 255, 0.06), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.024), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, rgba(17, 21, 27, 0.98), rgba(13, 17, 23, 0.98));
}

.auth-gate-copy {
  max-width: 720px;
}

.auth-gate-copy h3 {
  margin-bottom: 0.45rem;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 0.96;
  letter-spacing: -0.045em;
}

.auth-gate-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.auth-gate-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.auth-gate-points div {
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.024), rgba(255, 255, 255, 0.01)),
    rgba(255, 255, 255, 0.015);
}

.app-locked .page,
.app-locked .market-strip,
.app-locked .auth-empty-state {
  display: none !important;
}

.app-locked .nav-item {
  opacity: 0.5;
}

.market-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.market-cell {
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.008)),
    rgba(17, 21, 27, 0.92);
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

.market-cell strong {
  display: block;
  margin: 0.2rem 0 0.3rem;
  letter-spacing: -0.02em;
}

.market-cell small {
  color: var(--text-soft);
}

.review-rail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.018);
}

.review-preset-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.review-preset-row .ghost-btn.compact,
.review-preset-row .primary-btn.compact {
  padding: 0.58rem 0.75rem;
  font-size: 0.76rem;
}

.panel-actions,
.history-toolbar,
.review-preset-row {
  scrollbar-width: none;
}

.panel-actions::-webkit-scrollbar,
.history-toolbar::-webkit-scrollbar,
.review-preset-row::-webkit-scrollbar {
  display: none;
}

.topbar-left,
.topbar-right,
.panel-header,
.panel-actions,
.profile,
.recommendation-head,
.recommendation-meta,
.history-toolbar,
.settings-row,
.metric-row,
.quality-score,
.form-actions,
.auth-helper-row {
  display: flex;
  align-items: center;
}

.topbar-left,
.topbar-right {
  gap: 0.85rem;
}

.topbar-right {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 230px;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-dim);
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.ghost-btn,
.primary-btn,
.tag,
.filter-pill,
.chip,
.status-label {
  border-radius: 12px;
  font-weight: 600;
}

.ghost-btn,
.tag,
.filter-pill {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
}

.ghost-btn,
.primary-btn,
.tag {
  padding: 0.72rem 1rem;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.ghost-btn:hover,
.primary-btn:hover,
.tag:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.16);
}

.ghost-btn.active,
.tag.active {
  border-color: rgba(150, 168, 255, 0.34);
  background: rgba(150, 168, 255, 0.12);
}

.compact {
  padding: 0.52rem 0.8rem;
}

.primary-btn {
  border: 1px solid rgba(150, 168, 255, 0.35);
  background: linear-gradient(180deg, rgba(150, 168, 255, 0.22), rgba(150, 168, 255, 0.12));
  color: var(--text);
}

.primary-btn:hover {
  background: linear-gradient(180deg, rgba(150, 168, 255, 0.28), rgba(150, 168, 255, 0.15));
}

.profile {
  gap: 0.7rem;
  padding: 0.32rem 0.42rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.024), rgba(255, 255, 255, 0.012)),
    rgba(255, 255, 255, 0.02);
}

.session-chip {
  min-width: 208px;
}

.profile-badge {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(150, 168, 255, 0.18), transparent 58%),
    linear-gradient(180deg, rgba(150, 168, 255, 0.16), rgba(150, 168, 255, 0.08));
  font-weight: 700;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.dashboard-grid,
.page-grid {
  display: grid;
  gap: 1rem;
}

.dashboard-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.page-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.two-column > *,
.insights-layout > * {
  grid-column: span 6;
}

.hero-panel {
  grid-column: span 8;
  padding: 1.15rem;
}

.kpi-card {
  grid-column: span 4;
  padding: 1rem 1rem 0.95rem;
}

.chart-panel,
.table-panel,
.full-span {
  grid-column: span 12;
}

.onboarding-panel {
  padding: 1.1rem 1.1rem 1rem;
}

.insight-panel {
  grid-column: span 4;
}

.chart-panel {
  grid-column: span 4;
}

.table-panel {
  grid-column: span 8;
}

.hero-metrics {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.85rem 0 1.05rem;
}

.hero-copy {
  max-width: 560px;
}

.hero-value {
  display: block;
  margin-bottom: 0.35rem;
  font-size: clamp(2.3rem, 4vw, 3.8rem);
  line-height: 0.95;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.terminal-pill {
  padding: 0.48rem 0.72rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.hero-stats {
  display: grid;
  gap: 0.8rem;
  min-width: 220px;
}

.hero-stats div,
.snapshot-card,
.quality-card,
.recommendation-card,
.insight-item,
.settings-row,
.metric-list,
.theme-preview {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
}

.hero-stats div {
  padding: 0.72rem 0.82rem;
}

.hero-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.drawdown-panel,
.session-ladder {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.95rem;
  background: rgba(255, 255, 255, 0.015);
}

.drawdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.drawdown-head span,
.session-ladder span {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.drawdown-track,
.micro-track,
.split-meter {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.drawdown-track {
  margin-bottom: 0.45rem;
}

.drawdown-track span,
.micro-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(150, 168, 255, 0.28), rgba(150, 168, 255, 0.92));
}

.session-ladder {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.session-ladder div {
  padding-left: 0.8rem;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-stats span,
.snapshot-card span,
.metric-row span {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.panel {
  padding: 0.95rem;
}

.panel:hover,
.sidebar-card:hover,
.market-cell:hover,
.auth-gate-points div:hover {
  border-color: var(--border-strong);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.panel-header {
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.72rem;
}

.panel-header h3 {
  letter-spacing: -0.025em;
  line-height: 1.02;
}

.panel-subcopy {
  margin: 0.22rem 0 0;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

.chip,
.status-label {
  padding: 0.38rem 0.68rem;
  border: 1px solid var(--border);
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}

.equity-curve {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 0.95rem 0.8rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.005));
}

.equity-curve svg {
  width: 100%;
  height: 260px;
}

.grid-lines line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1;
}

.curve-line {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.curve-area {
  fill: url(#curveFill);
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.metric-value {
  display: block;
  margin: 0.55rem 0 0.38rem;
  font-size: 1.8rem;
}

.kpi-delta {
  display: inline-flex;
  margin-top: 0.1rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.kpi-delta.positive {
  border-color: rgba(108, 224, 162, 0.22);
  background: rgba(108, 224, 162, 0.08);
}

.kpi-delta.neutral {
  border-color: rgba(224, 182, 108, 0.18);
  background: rgba(224, 182, 108, 0.08);
}

.micro-track {
  margin-bottom: 0.75rem;
}

.split-meter {
  display: flex;
  margin-bottom: 0.75rem;
}

.split-meter span {
  display: block;
  height: 100%;
}

.positive-fill {
  background: rgba(108, 224, 162, 0.9);
}

.negative-fill {
  background: rgba(255, 107, 115, 0.6);
}

.bar-list,
.insight-stack,
.settings-list,
.quality-list,
.metric-list {
  display: grid;
  gap: 0.65rem;
}

.settings-list {
  gap: 0.8rem;
}

.settings-row {
  align-items: flex-start;
  padding: 0.95rem 1rem;
}

.settings-row > div:first-child {
  flex: 1;
  min-width: 0;
}

.settings-row strong {
  display: block;
  margin-bottom: 0.28rem;
  letter-spacing: -0.02em;
}

.settings-row p {
  margin: 0;
  max-width: 42ch;
  line-height: 1.52;
}

.settings-row > .ghost-btn,
.settings-row > .primary-btn {
  flex: 0 0 auto;
  align-self: center;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
}

.insight-chart-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin: -0.25rem 0 0.45rem;
  padding-left: 140px;
  color: var(--text-dim);
  font-size: 0.76rem;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.bar-fill.positive {
  background: linear-gradient(90deg, rgba(108, 224, 162, 0.35), rgba(108, 224, 162, 0.95));
}

.bar-fill.negative {
  background: linear-gradient(90deg, rgba(255, 107, 115, 0.35), rgba(255, 107, 115, 0.95));
}

.signal-dot {
  width: 10px;
  height: 10px;
  margin-top: 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(150, 168, 255, 0.08);
}

.signal-dot.positive {
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(108, 224, 162, 0.08);
}

.signal-dot.negative {
  background: var(--red);
  box-shadow: 0 0 0 5px rgba(255, 107, 115, 0.08);
}

.signal-dot.neutral {
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(224, 182, 108, 0.08);
}

.insight-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  padding: 0.8rem 0.85rem;
}

.insight-positive {
  border-left: 1px solid rgba(108, 224, 162, 0.35);
}

.insight-negative {
  border-left: 1px solid rgba(255, 107, 115, 0.35);
}

.insight-metric {
  display: inline-block;
  margin-top: 0.45rem;
  color: var(--text-dim);
}

.empty-state {
  padding: 1rem;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  color: var(--text-dim);
  text-align: center;
}

.empty-state-rich {
  display: grid;
  gap: 0.75rem;
  justify-items: center;
}

.empty-state-rich strong {
  color: var(--text);
}

.empty-state-rich p {
  max-width: 520px;
  margin: 0;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.012);
}

.table-wrap.tall {
  max-height: 540px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 0.8rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(23, 28, 35, 0.96);
  backdrop-filter: blur(10px);
  color: var(--text-dim);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table-sort {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  transition: color 160ms ease;
}

.table-sort:hover,
.table-sort.active {
  color: var(--text);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.row-badge {
  display: inline-flex;
  min-width: 40px;
  justify-content: center;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.row-badge.positive {
  border-color: rgba(108, 224, 162, 0.2);
  background: rgba(108, 224, 162, 0.08);
}

.row-badge.negative {
  border-color: rgba(255, 107, 115, 0.2);
  background: rgba(255, 107, 115, 0.08);
}

.note-cell {
  display: grid;
  gap: 0.45rem;
}

.note-cell span {
  display: -webkit-box;
  overflow: hidden;
  max-width: 32ch;
  color: var(--text-soft);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.row-inline-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.row-inline-flag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 0.7rem;
  line-height: 1;
  text-transform: uppercase;
}

.row-inline-flag.negative {
  border-color: rgba(255, 107, 115, 0.18);
  color: var(--red);
}

.review-modal-card {
  display: grid;
  gap: 1rem;
}

.review-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.review-section {
  padding: 1rem;
}

.review-context,
.review-notes {
  display: grid;
  gap: 0.85rem;
}

.review-next-list {
  display: grid;
  gap: 0.8rem;
}

.review-next-item {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.review-next-item strong {
  display: block;
  margin-bottom: 0.3rem;
  letter-spacing: -0.02em;
}

.review-next-item p {
  margin: 0;
  color: var(--text-dim);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.action-btn {
  min-width: 62px;
  justify-content: center;
}

.danger,
.danger-btn {
  border-color: rgba(255, 107, 115, 0.24);
  color: var(--red);
}

.danger-btn {
  background: linear-gradient(180deg, rgba(255, 107, 115, 0.18), rgba(255, 107, 115, 0.1));
}

.trade-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.trade-form label {
  display: grid;
  gap: 0.45rem;
}

.tag-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.55rem;
}

.field-brief {
  display: grid;
  gap: 0.3rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.field-brief strong {
  font-size: 0.9rem;
  letter-spacing: -0.02em;
}

.field-brief p,
.field-helper {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.55;
}

.tag-fieldset legend {
  padding: 0;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.confluence-groups {
  display: grid;
  gap: 0.8rem;
}

.confluence-group {
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
}

.confluence-group-title {
  color: var(--text-dim);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checkbox-tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.checkbox-tag {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.checkbox-tag input {
  position: absolute;
  opacity: 0;
  inset: 0;
  pointer-events: none;
}

.checkbox-tag span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0.55rem 0.78rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-soft);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.checkbox-tag:hover span {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.checkbox-tag input:checked + span {
  border-color: rgba(150, 168, 255, 0.34);
  background: rgba(150, 168, 255, 0.12);
  color: var(--text);
}

.checkbox-tag.recommended span {
  border-color: rgba(150, 168, 255, 0.2);
  background: rgba(150, 168, 255, 0.07);
  color: var(--text);
}

.checkbox-tag.recommended input:checked + span {
  border-color: rgba(150, 168, 255, 0.34);
  background: rgba(150, 168, 255, 0.14);
}

.checkbox-tag.deemphasized span {
  opacity: 0.72;
}

.trade-form span {
  color: var(--text-dim);
  font-size: 0.82rem;
}

.trade-form input,
.trade-form select,
.trade-form textarea {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  outline: none;
}

.trade-form input:focus,
.trade-form select:focus,
.trade-form textarea:focus {
  border-color: rgba(150, 168, 255, 0.35);
}

.full-width {
  grid-column: 1 / -1;
}

.tag-row,
.snapshot-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.tag.active {
  border-color: rgba(150, 168, 255, 0.35);
  background: rgba(150, 168, 255, 0.12);
}

.tab-row {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.form-actions {
  justify-content: flex-end;
  gap: 0.75rem;
}

.auth-helper-row {
  justify-content: space-between;
  gap: 0.75rem;
}

.form-status {
  margin: -0.1rem 0 0;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.form-status.success {
  color: var(--green);
}

.form-status.error {
  color: var(--red);
}

.quality-card {
  padding: 0.95rem;
}

.quality-score,
.settings-row,
.metric-row {
  justify-content: space-between;
  gap: 1rem;
}

.snapshot-grid {
  margin-top: 1rem;
}

.snapshot-card {
  flex: 1 1 180px;
  padding: 0.8rem 0.85rem;
}

.history-toolbar {
  gap: 0.6rem;
  overflow-x: auto;
  flex-wrap: nowrap;
  margin-bottom: 1rem;
  padding: 0 0 0.1rem;
}

.filter-pill {
  padding: 0.5rem 0.74rem;
  color: var(--text-soft);
  white-space: nowrap;
}

.spotlight-panel {
  grid-column: span 12;
}

.recommendation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.recommendation-card {
  padding: 0.9rem;
  position: relative;
  overflow: hidden;
}

.recommendation-card.priority {
  background: linear-gradient(180deg, rgba(108, 224, 162, 0.08), rgba(255, 255, 255, 0.02));
  border-color: rgba(108, 224, 162, 0.24);
}

.recommendation-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.recommendation-card.priority::before {
  background: rgba(108, 224, 162, 0.72);
}

.impact-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.95rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.impact-strip span {
  color: var(--text-dim);
  font-size: 0.8rem;
}

.status-label.positive {
  color: var(--green);
}

.status-label.neutral {
  color: var(--amber);
}

.metric-list {
  padding: 0.2rem;
}

.getting-started-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.getting-started-card {
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.getting-started-card.complete {
  border-color: rgba(108, 224, 162, 0.2);
  background: rgba(108, 224, 162, 0.05);
}

.getting-started-card strong {
  display: block;
  margin: 0.2rem 0 0.35rem;
  letter-spacing: -0.02em;
}

.getting-started-card p {
  margin: 0 0 0.8rem;
}

.getting-started-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.workspace-panel {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.workspace-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.import-hints {
  padding: 0.2rem 0;
}

.import-mapping {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.import-mapping-header {
  align-items: center;
}

.import-mapping-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.import-mapping-field {
  display: grid;
  gap: 0.45rem;
}

.import-mapping-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.import-mapping-field select {
  width: 100%;
  min-height: 44px;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
}

.import-preview-wrap {
  max-height: 280px;
}

.import-preview-wrap table {
  min-width: 100%;
}

.muted-chip {
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.08);
}

.metric-row {
  padding: 0.72rem 0.82rem;
}

.appearance-preview {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(220px, 0.92fr);
  align-items: start;
  gap: 1rem;
}

.settings-preview-card {
  display: grid;
  gap: 0.9rem;
}

.settings-preview-copy strong {
  display: block;
  margin: 0.18rem 0 0.35rem;
  letter-spacing: -0.02em;
}

.settings-preview-copy p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.52;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(7, 10, 14, 0.72);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.modal-shell.open {
  opacity: 1;
  pointer-events: auto;
}

.app-loading {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(9, 12, 16, 0.72);
  backdrop-filter: blur(10px);
}

.app-loading-card {
  width: min(420px, 100%);
  padding: 1.1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.026), rgba(255, 255, 255, 0.01)),
    linear-gradient(180deg, rgba(17, 21, 27, 0.98), rgba(13, 17, 23, 0.98));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
  text-align: center;
}

.app-loading-card strong {
  display: block;
  margin-bottom: 0.35rem;
  letter-spacing: -0.03em;
}

.app-loading-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.app-loading-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-bottom: 0.85rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(108, 224, 162, 0.45);
  animation: appPulse 1.4s ease-in-out infinite;
}

@keyframes appPulse {
  0% {
    transform: scale(0.96);
    box-shadow: 0 0 0 0 rgba(108, 224, 162, 0.35);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 12px rgba(108, 224, 162, 0);
  }
  100% {
    transform: scale(0.96);
    box-shadow: 0 0 0 0 rgba(108, 224, 162, 0);
  }
}

.modal-card {
  width: min(540px, 100%);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.012)),
    linear-gradient(180deg, rgba(17, 21, 27, 0.98), rgba(13, 17, 23, 0.98));
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
}

.modal-card-large {
  width: min(860px, 100%);
}

.modal-card-compact {
  width: min(520px, 100%);
}

.modal-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.theme-preview {
  padding: 1rem;
}

.preview-header {
  height: 18px;
  margin-bottom: 0.85rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04));
}

.preview-body {
  display: grid;
  gap: 0.65rem;
}

.preview-body span {
  display: block;
  height: 52px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.mobile-only {
  display: none;
}

@media (max-width: 1180px) {
  .market-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shell {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .sidebar {
    padding: 1rem 0.75rem;
  }

  .brand {
    justify-content: center;
  }

  .brand > :not(.brand-mark) {
    display: none;
  }

  .nav-item {
    padding: 0.85rem 0.75rem;
  }

  .nav-item small {
    display: none;
  }

  .nav-item span {
    font-size: 0.85rem;
  }

  .sidebar-card {
    display: none;
  }

  .hero-panel,
  .chart-panel,
  .table-panel,
  .insight-panel,
  .kpi-card,
  .two-column > *,
  .insights-layout > * {
    grid-column: span 12;
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    z-index: 20;
    width: min(300px, calc(100vw - 2rem));
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    padding: 0.9rem;
  }

  .topbar {
    position: static;
    padding: 0.85rem 0.9rem;
  }

  .topbar,
  .hero-metrics,
  .topbar-right,
  .auth-empty-state {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-left {
    align-items: center;
  }

  .mobile-only {
    display: inline-flex;
  }

  .topbar-right > *,
  .auth-empty-state > *,
  .auth-gate-actions > *,
  .settings-actions > * {
    width: 100%;
  }

  .search {
    min-width: 0;
  }

  .dashboard-grid,
  .page-grid,
  .trade-form,
  .recommendation-grid,
  .modal-form,
  .appearance-preview {
    grid-template-columns: 1fr;
  }

  .market-strip,
  .hero-lower,
  .session-ladder,
  .auth-gate-points,
  .getting-started-grid,
  .review-meta-grid,
  .workspace-metrics {
    grid-template-columns: 1fr;
  }

  .review-rail {
    align-items: flex-start;
    flex-direction: column;
  }

  .review-preset-row {
    justify-content: flex-start;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.1rem;
  }

  .panel-actions {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.1rem;
  }

  .panel-actions > *,
  .review-preset-row > * {
    flex: 0 0 auto;
  }

  .import-mapping-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    min-width: 0;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .insight-chart-meta {
    padding-left: 0;
  }

  .table-actions {
    flex-direction: column;
  }

  .settings-row {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-row > .ghost-btn,
  .settings-row > .primary-btn {
    width: 100%;
  }

  .session-chip {
    min-width: 0;
    width: 100%;
  }

  .profile {
    width: 100%;
  }

  .history-toolbar {
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }
}

@media (max-width: 560px) {
  .main {
    padding: 0.7rem;
  }

  .topbar,
  .panel,
  .auth-empty-state,
  .auth-gate,
  .modal-card {
    padding: 0.85rem;
    border-radius: 14px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }

  .topbar h2,
  .auth-gate-copy h3 {
    line-height: 1.02;
  }

  .hero-value {
    font-size: clamp(2rem, 12vw, 2.8rem);
  }

  .metric-value {
    font-size: 1.5rem;
  }

  .search,
  .ghost-btn,
  .primary-btn,
  .tag,
  .filter-pill,
  .trade-form input,
  .trade-form select,
  .trade-form textarea {
    min-height: 44px;
  }

  .hero-tags,
  .tag-row,
  .checkbox-tag-grid,
  .settings-actions,
  .auth-helper-row,
  .form-actions {
    gap: 0.5rem;
  }

  .auth-helper-row,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .bar-row {
    gap: 0.45rem;
  }

  .table-wrap {
    border-radius: 14px;
  }

  th,
  td {
    padding: 0.72rem 0.7rem;
  }

  .modal-shell {
    padding: 0.7rem;
  }

  .modal-card-large,
  .modal-card-compact {
    width: 100%;
  }
}

.ghost-btn span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}
