:root {
  color-scheme: light;
  --bg: #ecefe8;
  --surface: #fffdf7;
  --surface-2: #f6f3ea;
  --surface-3: #ebe9dd;
  --surface-hover: #f8fbf4;
  --chart-bg: #fbfaf4;
  --ink: #17201b;
  --muted: #65716b;
  --line: #d7d7ca;
  --sidebar: #16201c;
  --sidebar-soft: #22312b;
  --sidebar-text: #f5f1e8;
  --sidebar-muted: rgba(245, 241, 232, 0.7);
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-card: rgba(255, 255, 255, 0.05);
  --sidebar-line: rgba(255, 255, 255, 0.08);
  --on-accent: #ffffff;
  --brand-icon: #e8f6ef;
  --green: #0e7a55;
  --green-soft: #dff0e8;
  --red: #a33a34;
  --red-soft: #f4dfdc;
  --amber: #a96e18;
  --amber-soft: #f5e6c8;
  --blue: #2c6f9e;
  --blue-soft: #dbeaf3;
  --violet: #6757b8;
  --shadow: 0 18px 46px rgba(23, 32, 27, 0.09);
  --premium-fill: rgba(163, 58, 52, 0.06);
  --discount-fill: rgba(14, 122, 85, 0.07);
  --midline: rgba(23, 32, 27, 0.24);
  --fvg-fill: rgba(44, 111, 158, 0.14);
  --fvg-stroke: rgba(44, 111, 158, 0.5);
  --order-block-fill: rgba(169, 110, 24, 0.16);
  --order-block-stroke: rgba(169, 110, 24, 0.52);
  --chart-label: rgba(23, 32, 27, 0.7);
  --green-border: rgba(14, 122, 85, 0.18);
  --green-border-strong: rgba(14, 122, 85, 0.36);
  --red-border: rgba(163, 58, 52, 0.28);
  --amber-border: rgba(169, 110, 24, 0.25);
  --radius: 8px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1413;
  --surface: #17201d;
  --surface-2: #1e2925;
  --surface-3: #27342f;
  --surface-hover: #20352d;
  --chart-bg: #121b18;
  --ink: #eef4ed;
  --muted: #9aa9a0;
  --line: #33423b;
  --sidebar: #0b1110;
  --sidebar-soft: #17231f;
  --sidebar-text: #f3f8f2;
  --sidebar-muted: rgba(243, 248, 242, 0.68);
  --sidebar-hover: rgba(255, 255, 255, 0.07);
  --sidebar-card: rgba(255, 255, 255, 0.055);
  --sidebar-line: rgba(255, 255, 255, 0.09);
  --on-accent: #071712;
  --brand-icon: #e8f6ef;
  --green: #48d196;
  --green-soft: #123c2d;
  --red: #ff7d72;
  --red-soft: #43211f;
  --amber: #f3bd5d;
  --amber-soft: #3d2c12;
  --blue: #78b8e8;
  --blue-soft: #17344a;
  --violet: #a79af2;
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.34);
  --premium-fill: rgba(255, 125, 114, 0.09);
  --discount-fill: rgba(72, 209, 150, 0.09);
  --midline: rgba(238, 244, 237, 0.22);
  --fvg-fill: rgba(120, 184, 232, 0.17);
  --fvg-stroke: rgba(120, 184, 232, 0.52);
  --order-block-fill: rgba(243, 189, 93, 0.16);
  --order-block-stroke: rgba(243, 189, 93, 0.5);
  --chart-label: rgba(238, 244, 237, 0.78);
  --green-border: rgba(72, 209, 150, 0.22);
  --green-border-strong: rgba(72, 209, 150, 0.42);
  --red-border: rgba(255, 125, 114, 0.3);
  --amber-border: rgba(243, 189, 93, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.auth-shell {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
  background: var(--bg);
}

.auth-shell::before,
.auth-shell::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}

.auth-shell::before {
  z-index: -2;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--line) 32%, transparent) 1px, transparent 1px),
    linear-gradient(0deg, color-mix(in srgb, var(--line) 24%, transparent) 1px, transparent 1px),
    var(--bg);
  background-size: 56px 56px, 56px 56px, auto;
}

.auth-shell::after {
  z-index: -1;
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--surface) 82%, transparent) 0 32%, transparent 32%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 38%, transparent), transparent 52%);
}

.auth-panel {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: clamp(22px, 5vw, 56px);
  background: color-mix(in srgb, var(--surface) 97%, var(--bg));
  border-right: 1px solid var(--line);
  box-shadow: 18px 0 46px color-mix(in srgb, var(--ink) 7%, transparent);
}

.auth-card {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 3.5vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-brand,
.sidebar-user,
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-brand strong,
.auth-brand span {
  display: block;
}

.auth-brand span,
.sidebar-user,
.user-chip {
  color: var(--muted);
}

.auth-heading {
  display: grid;
  gap: 9px;
}

.auth-heading h1 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(2.15rem, 5vw, 3.85rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.auth-heading p:last-child {
  max-width: 34rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.auth-tabs button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
}

.auth-tabs button.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ink) 8%, transparent);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-field {
  display: grid;
  gap: 7px;
}

.auth-field > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.auth-input-wrap {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.auth-input-wrap:focus-within {
  color: var(--green);
  border-color: var(--green-border-strong);
  box-shadow: 0 0 0 3px var(--green-border);
}

.auth-input-wrap input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-weight: 800;
}

.auth-input-wrap input::placeholder {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}

.auth-status {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  line-height: 1.35;
}

.auth-status span:last-child {
  min-width: 0;
}

.auth-submit {
  min-height: 46px;
}

.auth-session-card {
  min-height: 300px;
  align-content: center;
}

.auth-loader {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.auth-loader span {
  width: 24px;
  height: 24px;
  border: 3px solid var(--green-border);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: auth-spin 760ms linear infinite;
}

.auth-loader strong {
  font-size: 0.94rem;
}

.auth-rail {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 20px;
  padding: clamp(20px, 4vw, 44px);
  background:
    linear-gradient(135deg, transparent 0 57%, color-mix(in srgb, var(--surface-2) 42%, transparent) 57% 57.5%, transparent 57.5%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 24%, transparent), transparent 48%);
}

.auth-rail > .icon-button {
  justify-self: end;
}

.auth-rail-content {
  align-self: center;
  max-width: 760px;
  display: grid;
  gap: 18px;
}

.auth-rail-content h2 {
  max-width: 17ch;
  margin: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.auth-market-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 620px;
}

.auth-market-strip article {
  min-height: 94px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-market-strip span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.auth-market-strip strong {
  font-size: 1.35rem;
}

.auth-scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 620px;
}

.auth-scope-grid span {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 800;
}

.auth-scope-grid svg {
  flex: 0 0 auto;
  color: var(--green);
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 16px;
  color: var(--sidebar-text);
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--brand-icon);
  background: var(--green);
  border-radius: var(--radius);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand span {
  margin-top: 2px;
  color: var(--sidebar-muted);
  font-size: 0.78rem;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--sidebar-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
}

.nav-item:hover,
.nav-item:focus-visible {
  color: var(--sidebar-text);
  background: var(--sidebar-hover);
  outline: none;
}

.nav-item.active {
  color: var(--sidebar-text);
  background: var(--sidebar-soft);
  border-color: var(--sidebar-line);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--sidebar-card);
  border: 1px solid var(--sidebar-line);
  border-radius: var(--radius);
}

.sidebar-footer small {
  color: var(--sidebar-muted);
  line-height: 1.45;
}

.sidebar-user {
  min-width: 0;
  color: var(--sidebar-text);
  font-size: 0.82rem;
  font-weight: 800;
}

.sidebar-user span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-chip {
  min-height: 36px;
  max-width: 190px;
  padding: 8px 11px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 800;
}

.user-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-toggle strong {
  display: grid;
  place-items: center;
  min-width: 20px;
  min-height: 20px;
  padding: 0 6px;
  color: var(--on-accent);
  background: var(--green);
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.primary-surface {
  min-width: 0;
}

.view-stack {
  display: grid;
  gap: 18px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric-tile,
.section-panel,
.agent-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-tile {
  min-height: 128px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 5px;
  padding: 16px;
}

.metric-tile svg {
  color: var(--blue);
}

.metric-tile.good svg {
  color: var(--green);
}

.metric-tile.warn svg {
  color: var(--amber);
}

.metric-tile.bad svg {
  color: var(--red);
}

.metric-tile span,
.metric-tile small,
.panel-header > span,
.compact-copy,
.activity-row span,
.field span,
.settings-row span,
.runtime-line span {
  color: var(--muted);
}

.metric-tile span {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-tile strong {
  margin-top: 2px;
  font-size: 1.42rem;
  line-height: 1.08;
}

.metric-tile small {
  line-height: 1.35;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}

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

.section-panel,
.agent-panel {
  padding: 16px;
}

.section-panel.wide {
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title svg {
  flex: 0 0 auto;
  color: var(--green);
}

.panel-title h2 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.2;
}

.panel-header > span {
  flex: 0 0 auto;
  font-size: 0.82rem;
}

.toolbar-button,
.icon-button,
.primary-button,
.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform 150ms ease,
    background 150ms ease,
    border-color 150ms ease;
}

.toolbar-button,
.icon-button {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

.toolbar-button {
  padding: 8px 11px;
}

.icon-button {
  width: 38px;
  padding: 0;
}

.toolbar-button:hover,
.icon-button:hover,
.primary-button:hover,
.table-action:hover {
  transform: translateY(-1px);
}

.toolbar-button.warn {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber-border);
}

.toolbar-button.favorite-filter.active,
.favorite-button.active {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: var(--amber-border);
}

.favorite-button {
  width: 32px;
  min-height: 30px;
  color: var(--muted);
  background: var(--surface-2);
}

.favorite-button.active svg,
.toolbar-button.favorite-filter.active svg,
.symbol-strip button.favorite svg {
  fill: currentColor;
}

.toolbar-button.danger,
.toolbar-button.danger-outline {
  color: var(--red);
  background: var(--red-soft);
  border-color: var(--red-border);
}

.primary-button {
  width: 100%;
  padding: 10px 14px;
  color: var(--on-accent);
  font-weight: 800;
  background: var(--green);
  border: 1px solid var(--green);
}

.table-action {
  min-height: 30px;
  padding: 6px 10px;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  font-size: 0.82rem;
  font-weight: 800;
}

.segmented {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 3px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented button {
  min-width: 48px;
  min-height: 28px;
  padding: 5px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: capitalize;
}

.segmented button.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ink) 8%, transparent);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1;
  text-transform: capitalize;
  white-space: nowrap;
}

.status-pill.good {
  color: var(--green);
  background: var(--green-soft);
}

.status-pill.bad {
  color: var(--red);
  background: var(--red-soft);
}

.status-pill.warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-pill.neutral {
  color: var(--blue);
  background: var(--blue-soft);
}

.chart-toolbar,
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.market-data-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.market-data-copy {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  flex-wrap: wrap;
}

.market-data-copy > span:last-child {
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.35;
}

.market-data-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.market-data-stats span {
  display: grid;
  gap: 2px;
  min-width: 68px;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.market-data-stats small {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.market-data-stats strong {
  color: var(--ink);
  font-size: 0.83rem;
}

.symbol-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.symbol-strip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  min-width: 54px;
  padding: 6px 10px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
}

.symbol-strip button.active {
  color: var(--on-accent);
  background: var(--ink);
  border-color: var(--ink);
}

.chart-card {
  width: 100%;
  overflow: hidden;
  background: var(--chart-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.chart-card svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-empty {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.premium-zone {
  fill: var(--premium-fill);
}

.discount-zone {
  fill: var(--discount-fill);
}

.midline {
  stroke: var(--midline);
  stroke-dasharray: 6 7;
}

.axis-grid {
  stroke: var(--midline);
  stroke-width: 1;
  stroke-dasharray: 3 8;
  opacity: 0.76;
}

.axis-line {
  stroke: var(--midline);
  stroke-width: 1.2;
}

.fvg-zone {
  fill: var(--fvg-fill);
  stroke: var(--fvg-stroke);
}

.order-block-zone {
  fill: var(--order-block-fill);
  stroke: var(--order-block-stroke);
}

.wick {
  stroke-width: 1.4;
}

.wick.up,
.candle.up {
  stroke: var(--green);
  fill: var(--green);
}

.wick.down,
.candle.down {
  stroke: var(--red);
  fill: var(--red);
}

.price-line {
  stroke-width: 1.6;
  stroke-dasharray: 4 5;
}

.price-line.entry,
.price-text.entry {
  stroke: var(--blue);
  fill: var(--blue);
}

.price-line.stop,
.price-text.stop {
  stroke: var(--red);
  fill: var(--red);
}

.price-line.target,
.price-text.target {
  stroke: var(--green);
  fill: var(--green);
}

.price-text,
.chart-label,
.zone-label,
.sweep-label,
.axis-label {
  font-size: 13px;
  font-weight: 800;
}

.axis-label {
  fill: var(--chart-label);
  font-size: 11px;
}

.price-axis-label {
  font-variant-numeric: tabular-nums;
}

.price-text {
  stroke-width: 0;
}

.sweep-label,
.zone-label {
  paint-order: stroke;
  stroke: var(--chart-bg);
  stroke-width: 3px;
}

.chart-label {
  fill: var(--chart-label);
}

.zone-label {
  fill: var(--blue);
}

.sweep-label {
  fill: var(--violet);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.level {
  display: grid;
  gap: 3px;
  min-height: 66px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.level span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.level strong {
  font-size: 1.1rem;
}

.level.good strong {
  color: var(--green);
}

.level.bad strong {
  color: var(--red);
}

.trade-plan {
  display: grid;
  gap: 12px;
}

.concept-chip-list,
.concept-grid {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.concept-chip-list span,
.concept-grid article {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 6px 9px;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.compact-copy {
  margin: 0;
  line-height: 1.45;
}

.opportunity-list,
.activity-feed,
.runtime-summary,
.log-list,
.account-list,
.breaker-list,
.journal-list {
  display: grid;
  gap: 9px;
}

.opportunity-row,
.account-row,
.breaker,
.log-row {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
}

.opportunity-row:hover,
.opportunity-row.active,
.account-row:hover,
.account-row.active,
.breaker:hover,
.breaker.active {
  border-color: var(--green-border-strong);
  background: var(--surface-hover);
}

.opportunity-row strong,
.opportunity-row small,
.account-row strong,
.account-row small,
.log-row strong,
.log-row small {
  display: block;
}

.opportunity-row small,
.account-row small,
.log-row small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.3;
}

.runtime-summary p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.runtime-line,
.analysis-row,
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.runtime-line:last-of-type,
.analysis-row:last-child,
.settings-row:last-child {
  border-bottom: 0;
}

.activity-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.activity-row:last-child {
  border-bottom: 0;
}

.activity-row p {
  margin: 0;
  line-height: 1.4;
}

.activity-row.good p {
  color: var(--green);
}

.activity-row.warn p {
  color: var(--amber);
}

.activity-row.bad p {
  color: var(--red);
}

.search-box {
  min-width: min(420px, 100%);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.search-box input,
.field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.scanner-tabbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.scanner-tabbar button {
  min-height: 36px;
  padding: 7px 13px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
}

.scanner-tabbar button.active {
  color: var(--on-accent);
  background: var(--ink);
  border-color: var(--ink);
}

.scanner-source {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
  flex-wrap: wrap;
}

.scanner-source > span:last-child,
.scanner-count {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.scanner-count {
  margin: -2px 0 10px;
}

.scanner-inline-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 3px 0;
}

.scanner-inline-control > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-toggle.active {
  color: var(--green);
  background: var(--green-soft);
  border-color: var(--green-border-strong);
}

.scanner-filter-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 10px;
  margin: 0 0 12px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filter-group {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

.filter-group > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-group .segmented {
  width: 100%;
  justify-content: flex-start;
  overflow-x: auto;
}

.filter-group .segmented button {
  flex: 0 0 auto;
  padding-inline: 8px;
}

.scanner-reset-button {
  align-self: end;
  justify-self: start;
  min-width: 92px;
}

.scanner-table,
.order-table {
  display: grid;
  overflow-x: auto;
}

.scanner-row,
.order-row {
  display: grid;
  align-items: center;
  gap: 12px;
  min-width: 920px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.scanner-row {
  grid-template-columns: 58px 170px 92px 92px minmax(260px, 1fr) 76px 60px 156px;
  border-radius: 0;
  cursor: pointer;
}

.scanner-row:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

.scanner-row.active,
.scanner-row:hover {
  background: var(--surface-hover);
}

.scanner-row span,
.order-row span {
  min-width: 0;
}

.scanner-row strong,
.scanner-row small {
  display: block;
}

.scanner-row small {
  margin-top: 2px;
  color: var(--muted);
}

.scanner-head,
.order-head {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: default;
}

.scanner-sort-button {
  width: 100%;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
}

.scanner-sort-button svg {
  flex: 0 0 auto;
  opacity: 0.72;
}

.scanner-sort-button.active,
.scanner-sort-button:hover,
.scanner-sort-button:focus-visible {
  color: var(--ink);
}

.scanner-sort-button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 4px;
}

.scanner-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: nowrap;
}

.scanner-empty-row {
  grid-template-columns: 1fr;
  color: var(--muted);
  cursor: default;
}

.scanner-empty-row:hover {
  background: transparent;
}

.scanner-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.scanner-page-summary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.scanner-page-summary span {
  color: var(--ink);
}

.scanner-page-size {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.scanner-page-size select {
  min-height: 32px;
  padding: 5px 28px 5px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
}

.scanner-page-buttons {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.scanner-page-button {
  min-width: 34px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-weight: 900;
  cursor: pointer;
}

.scanner-page-button.icon {
  width: 34px;
  padding-inline: 5px;
}

.scanner-page-button.active,
.scanner-page-button:hover:not(:disabled),
.scanner-page-button:focus-visible {
  color: var(--on-accent);
  background: var(--ink);
  border-color: var(--ink);
}

.scanner-page-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.scanner-page-gap {
  min-width: 18px;
  color: var(--muted);
  text-align: center;
  font-weight: 900;
}

.screener-trade-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 14px;
  align-items: start;
}

.screener-main-column {
  min-width: 0;
}

.screener-trade-panel {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 12px;
}

.screener-ticket .ticket-symbol {
  align-items: flex-start;
}

.screener-ticket .ticket-symbol span {
  min-width: 0;
}

.screener-ticket .ticket-symbol small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.screener-ticket-actions,
.screener-order-preview-head,
.screener-order-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.screener-ticket-actions {
  flex-wrap: wrap;
}

.screener-gates {
  grid-template-columns: 1fr;
}

.screener-risk-strip,
.screener-order-preview {
  display: grid;
  gap: 10px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.screener-order-preview-head span,
.screener-order-preview p,
.screener-order-card small {
  color: var(--muted);
}

.screener-order-preview-head {
  font-size: 0.82rem;
}

.screener-order-preview-head span {
  font-weight: 800;
}

.screener-order-preview p {
  margin: 0;
  line-height: 1.45;
}

.screener-order-card {
  min-height: 54px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.screener-order-card > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.screener-order-card > span:last-child {
  justify-items: end;
}

.screener-order-card strong,
.screener-order-card small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-subnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin: -2px 0 12px;
}

.chart-focus-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  align-items: start;
}

.analysis-rail {
  display: grid;
  gap: 12px;
}

.replay-panel {
  overflow: hidden;
  color: #eef5f0;
  background: #080909;
  border: 1px solid color-mix(in srgb, var(--line) 70%, #000 30%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.replay-window-bar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px 0 8px;
  background: #1d1d1d;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.replay-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.replay-brand strong,
.replay-header-line h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.replay-back-button {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #0c0c0c;
  background: #f6f8f5;
  cursor: pointer;
}

.replay-back-button::before,
.replay-back-button::after {
  position: absolute;
  top: 50%;
  content: "";
  width: 10px;
  height: 10px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.replay-back-button::before {
  left: 10px;
}

.replay-back-button::after {
  left: 18px;
}

.replay-back-button span {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  background: #5ac6ad;
  border: 2px solid #0f1010;
  border-radius: 999px;
}

.replay-trade-button {
  min-height: 36px;
  padding: 6px 18px;
  color: #eef5f0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.replay-window-actions {
  display: flex;
  align-items: center;
  gap: 22px;
}

.replay-window-actions span {
  width: 22px;
  height: 16px;
  border-bottom: 2px solid rgba(238, 245, 240, 0.7);
}

.replay-window-actions span:nth-child(2) {
  border: 0;
  border-top: 2px solid rgba(238, 245, 240, 0.7);
  border-right: 2px solid rgba(238, 245, 240, 0.7);
}

.replay-window-actions span:nth-child(3) {
  width: 14px;
  border: 0;
  border-top: 2px solid rgba(238, 245, 240, 0.7);
  border-right: 2px solid rgba(238, 245, 240, 0.7);
}

.replay-content {
  display: grid;
  gap: 18px;
  padding: 22px 20px 28px;
}

.replay-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.replay-download {
  color: #eef5f0;
  background: #111;
  border-color: rgba(255, 255, 255, 0.22);
}

.replay-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.replay-tabs button {
  min-height: 42px;
  padding: 8px 17px;
  color: #f3f4f0;
  background: #2d2d2d;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.replay-tabs button.active {
  color: #0d0d0d;
  background: #f5f5f2;
}

.replay-table-wrap {
  overflow-x: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.replay-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.replay-table th {
  padding: 18px 20px;
  color: rgba(238, 245, 240, 0.58);
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
}

.replay-table td {
  padding: 16px 20px;
  color: rgba(238, 245, 240, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  vertical-align: middle;
}

.replay-entry-row td:not([rowspan]) {
  border-top-color: rgba(255, 255, 255, 0.22);
}

.replay-table .numeric {
  text-align: right;
  white-space: nowrap;
}

.replay-table small {
  display: block;
  margin-top: 5px;
  color: rgba(238, 245, 240, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.replay-table strong {
  color: #f7fbf7;
}

.replay-trade-number {
  min-width: 110px;
}

.replay-trade-number span {
  margin-right: 8px;
}

.replay-trade-number strong {
  color: #4f83ff;
}

.replay-size-cell strong,
.replay-pnl-cell strong {
  font-size: 1.02rem;
}

.replay-pnl-cell.good strong,
.replay-pnl-cell.good small {
  color: #39b49b;
}

.replay-pnl-cell.bad strong,
.replay-pnl-cell.bad small {
  color: #eef5f0;
}

.replay-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.replay-metric {
  min-height: 108px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 16px;
  background: #111514;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
}

.replay-metric span,
.replay-metric small {
  color: rgba(238, 245, 240, 0.64);
  font-size: 0.78rem;
  font-weight: 800;
}

.replay-metric span {
  text-transform: uppercase;
}

.replay-metric strong {
  color: #f7fbf7;
  font-size: 1.2rem;
}

.replay-metric.good strong {
  color: #39b49b;
}

.replay-metric.bad strong {
  color: #ff7d72;
}

.analysis-card {
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.analysis-card h3,
.settings-section h3 {
  margin: 0 0 8px;
  font-size: 0.94rem;
}

.score-meter {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.score-meter.compact {
  padding: 0;
  background: transparent;
  border: 0;
}

.score-ring {
  --size: 76px;
  width: var(--size);
  height: var(--size);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, var(--surface) 57%, transparent 58%),
    conic-gradient(var(--green) calc(var(--score) * 1%), var(--surface-3) 0);
  border-radius: 50%;
}

.score-meter.compact .score-ring {
  --size: 44px;
}

.score-ring span {
  font-weight: 900;
}

.score-meter strong,
.score-meter small {
  display: block;
}

.score-meter small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.concept-grid {
  margin-top: 10px;
}

.ticket,
.order-gates,
.risk-budget,
.settings-sections {
  display: grid;
  gap: 10px;
}

.ticket-symbol {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ticket-symbol strong {
  font-size: 1.6rem;
}

.order-gates,
.compliance-grid,
.account-metrics,
.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  display: grid;
  gap: 10px;
}

.gate {
  min-height: 56px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.gate strong {
  grid-column: 2;
}

.gate.ok svg {
  color: var(--green);
}

.gate.blocked svg {
  color: var(--red);
}

.order-row {
  grid-template-columns: 88px 88px 70px 80px 80px 80px 80px 86px;
}

.model-grid {
  display: grid;
  gap: 9px;
}

.model-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 110px 90px 90px 70px 120px;
  align-items: center;
  gap: 10px;
  padding: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.model-row strong,
.model-row small {
  display: block;
}

.model-row small {
  margin-top: 3px;
  color: var(--muted);
}

.journal-row {
  display: grid;
  grid-template-columns: 48px 64px 76px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.journal-row p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.field {
  min-height: 76px;
  display: grid;
  gap: 7px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.field span {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input {
  min-height: 34px;
  font-weight: 800;
}

.settings-sections {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}

.settings-section {
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.settings-row strong {
  max-width: 58%;
  text-align: right;
  line-height: 1.35;
}

.panel-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.panel-actions .primary-button {
  width: auto;
}

.breaker {
  min-height: 76px;
}

.breaker span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.breaker small {
  color: var(--muted);
  line-height: 1.35;
}

.progress {
  display: grid;
  gap: 7px;
}

.progress > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.progress.compact > div:first-child {
  display: block;
}

.progress span {
  color: var(--muted);
}

.progress-track {
  height: 10px;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: 999px;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.progress-track span.good {
  background: var(--green);
}

.progress-track span.warn {
  background: var(--amber);
}

.progress-track span.bad {
  background: var(--red);
}

.correlation-table {
  display: grid;
  gap: 11px;
  margin-top: 16px;
}

.correlation-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(180px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.correlation-row strong,
.correlation-row small {
  display: block;
}

.correlation-row small {
  color: var(--muted);
  margin-top: 3px;
}

.agent-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: min(430px, calc(100vw - 24px));
  height: 100vh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  box-shadow: -18px 0 42px color-mix(in srgb, var(--ink) 18%, transparent);
  animation: chat-drawer-in 180ms ease-out;
}

.chat-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: color-mix(in srgb, var(--ink) 34%, transparent);
  border: 0;
  cursor: pointer;
}

.chat-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chat-drawer-header .panel-header {
  flex: 1;
  min-width: 0;
}

@keyframes chat-drawer-in {
  from {
    transform: translateX(18px);
    opacity: 0.65;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.agent-context {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.agent-context div {
  display: grid;
  gap: 3px;
  padding: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.agent-context span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.chat-log {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding-right: 4px;
}

.chat-message {
  display: grid;
  gap: 4px;
}

.chat-message span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.chat-message p {
  margin: 0;
  padding: 10px;
  line-height: 1.45;
  border-radius: var(--radius);
}

.chat-message.agent p {
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.chat-message.operator {
  justify-items: end;
}

.chat-message.operator p {
  color: var(--on-accent);
  background: var(--green);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.chat-form input {
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

.chat-form button {
  display: grid;
  place-items: center;
  min-height: 42px;
  color: var(--on-accent);
  background: var(--green);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

.finding-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.finding-list p {
  margin: 0;
  padding: 10px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}

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

  .dashboard-layout,
  .dashboard-layout.bottom,
  .content-grid,
  .screener-trade-grid,
  .chart-focus-grid {
    grid-template-columns: 1fr;
  }

  .screener-trade-panel {
    position: static;
  }

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

  .scanner-filter-panel {
    grid-template-columns: repeat(2, minmax(210px, 1fr));
  }
}

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
    background: var(--bg);
  }

  .auth-shell::after {
    background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 52%, transparent), transparent 42%);
  }

  .auth-panel,
  .auth-rail {
    min-height: auto;
  }

  .auth-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 42px color-mix(in srgb, var(--ink) 8%, transparent);
  }

  .auth-rail {
    padding-top: 22px;
  }

  .auth-rail-content {
    align-self: start;
  }

  .auth-rail-content h2,
  .auth-heading h1 {
    max-width: 100%;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 12px;
    padding: 12px;
  }

  .brand {
    min-height: 40px;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    flex: 0 0 42px;
    width: 42px;
    min-height: 40px;
    justify-content: center;
  }

  .nav-item span {
    display: none;
  }

  .sidebar-footer {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    padding: 8px 10px;
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .settings-sections,
  .settings-grid,
  .account-metrics,
  .order-gates,
  .compliance-grid,
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .scanner-filter-panel {
    grid-template-columns: 1fr;
  }

  .scanner-inline-control,
  .scanner-pagination,
  .scanner-page-summary,
  .scanner-page-size,
  .scanner-page-buttons {
    width: 100%;
  }

  .scanner-inline-control {
    align-items: flex-start;
    flex-direction: column;
  }

  .scanner-page-summary {
    justify-content: space-between;
  }

  .scanner-page-buttons {
    justify-content: flex-start;
  }

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

  .market-data-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .market-data-stats {
    justify-content: flex-start;
  }

}

@media (max-width: 560px) {
  .auth-panel,
  .auth-rail {
    padding: 18px;
  }

  .auth-scope-grid {
    grid-template-columns: 1fr;
  }

  .auth-market-strip {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 10px;
  }

  .topbar h1 {
    font-size: 1.55rem;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    align-items: stretch;
  }

  .topbar-actions > .status-pill,
  .topbar-actions > .segmented,
  .topbar-actions > .user-chip {
    grid-column: 1 / -1;
  }

  .topbar-actions > .status-pill {
    justify-self: start;
  }

  .topbar-actions .toolbar-button,
  .topbar-actions .icon-button,
  .topbar-actions .user-chip {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .topbar-actions .toolbar-button {
    padding: 8px 9px;
  }

  .topbar-actions .toolbar-button span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .section-panel,
  .agent-panel,
  .metric-tile {
    padding: 12px;
  }

  .panel-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .panel-header > span {
    flex: 1 1 100%;
    white-space: normal;
    text-align: left;
  }

  .level-grid {
    grid-template-columns: 1fr;
  }

  .agent-context {
    grid-template-columns: 1fr;
  }

  .replay-window-bar {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px;
  }

  .replay-window-actions {
    display: none;
  }

  .replay-content {
    padding: 14px 10px 16px;
  }

  .replay-tabs button {
    min-height: 36px;
    padding: 7px 12px;
  }

  .replay-metrics-grid {
    grid-template-columns: 1fr;
  }
}
