:root {
  color-scheme: dark;
  --bg: #0b1014;
  --surface: #10171c;
  --surface-raised: #141d23;
  --surface-active: #19252b;
  --line: #27343c;
  --line-strong: #3a4a53;
  --text: #e5ecef;
  --text-soft: #b5c1c7;
  --muted: #7f9099;
  --accent: #4f957b;
  --accent-strong: #68b293;
  --accent-ink: #08130f;
  --warning: #c79352;
  --danger: #c76569;
  --info: #6894ad;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --header-height: 60px;
  --radius: 2px;
  --sans: "IBM Plex Sans", "Bahnschrift", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}

/* Isolated market-maker terminal */
.mm-view {
  min-width: 0;
}

.mm-panel {
  display: grid;
  gap: var(--space-4);
  min-height: calc(100dvh - var(--header-height) - 32px);
}

.mm-header,
.mm-section > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.mm-header h1,
.mm-section h2 {
  margin: 0;
}

.mm-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.mm-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.mm-state {
  min-width: 96px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text-soft);
  font: 650 12px/1 var(--mono);
  text-align: center;
}

.mm-state[data-state="QUOTING"] { border-color: var(--accent); color: var(--accent-strong); }
.mm-state[data-state="CLOSE_ONLY"] { border-color: var(--warning); color: var(--warning); }
.mm-state[data-state="FAULT"],
.mm-state[data-state="PAUSED"] { border-color: var(--danger); color: var(--danger); }

.mm-alert {
  padding: 10px 12px;
  border-left: 3px solid var(--line-strong);
  background: var(--surface-raised);
  color: var(--text-soft);
}

.mm-alert.is-good { border-color: var(--accent); }
.mm-alert.is-warning { border-color: var(--warning); }
.mm-alert.is-error { border-color: var(--danger); }

.mm-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.mm-metrics > div {
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  border-right: 1px solid var(--line);
}

.mm-metrics > div:last-child { border-right: 0; }
.mm-metrics dt { color: var(--muted); font-size: 11px; }
.mm-metrics dd { overflow: hidden; margin: 4px 0 0; font: 650 16px/1.2 var(--mono); text-overflow: ellipsis; }

.mm-workbench {
  display: grid;
  grid-template-columns: minmax(220px, .75fr) minmax(480px, 2fr) minmax(220px, .8fr);
  gap: var(--space-3);
  min-height: 390px;
}

.mm-section {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.mm-section > header {
  min-height: 46px;
  padding: 0 var(--space-3);
  border-bottom: 1px solid var(--line);
}

.mm-section > header h2 { font-size: 13px; }
.mm-section > header span { color: var(--muted); font-size: 11px; }

.mm-book-head,
.mm-book-side > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  padding: 4px var(--space-3);
  font-family: var(--mono);
  text-align: right;
}

.mm-book-head { color: var(--muted); font: 10px/1.2 var(--sans); }
.mm-book-side { display: flex; min-height: 130px; flex-direction: column; justify-content: flex-end; }
.mm-book-side > div { position: relative; font-size: 11px; }
.mm-book-side > div::before { content: ""; position: absolute; inset: 1px 0 1px auto; z-index: 0; width: var(--depth); background: currentColor; opacity: .06; }
.mm-book-side span { position: relative; }
.mm-asks { color: #d77c7f; }
.mm-bids { justify-content: flex-start; color: #65b394; }
.mm-book-index { padding: 10px var(--space-3); border-block: 1px solid var(--line); color: var(--text); font: 700 18px/1 var(--mono); text-align: right; }

.mm-table-scroll { overflow: auto; max-height: 342px; }
.mm-table { width: 100%; border-collapse: collapse; font-size: 11px; white-space: nowrap; }
.mm-table th { position: sticky; top: 0; z-index: 1; padding: 9px 10px; background: var(--surface-raised); color: var(--muted); font-weight: 600; text-align: left; }
.mm-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); font-family: var(--mono); }
.mm-side-buy { color: var(--accent-strong); }
.mm-side-sell { color: var(--danger); }

.mm-risk-list { display: grid; gap: 0; margin: 0; }
.mm-risk-list > div { display: flex; justify-content: space-between; gap: var(--space-3); padding: 10px var(--space-3); border-bottom: 1px solid var(--line); }
.mm-risk-list dt { color: var(--muted); }
.mm-risk-list dd { margin: 0; font-family: var(--mono); text-align: right; }
.mm-preflight { margin: var(--space-3); padding: var(--space-3); border: 1px solid var(--line); background: var(--bg); color: var(--text-soft); font-size: 12px; }
.mm-preflight.is-good { border-color: var(--accent); }

.mm-lower-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr 1.25fr;
  gap: var(--space-3);
}

.mm-config { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); padding: var(--space-3); align-items: end; }
.mm-config label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; }
.mm-config input { width: 100%; min-height: 36px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); padding: 0 9px; font-family: var(--mono); }
.mm-config .button { grid-column: 1 / -1; }
.mm-baskets { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); padding: var(--space-3); }
.mm-basket { padding: var(--space-3); border: 1px solid var(--line); background: var(--bg); }
.mm-basket strong { display: block; margin-bottom: 5px; font-family: var(--mono); }
.mm-basket span { color: var(--muted); font-size: 11px; }
.mm-log-list { overflow: auto; max-height: 170px; }
.mm-log-row { display: grid; grid-template-columns: 72px 56px 1fr; gap: var(--space-2); padding: 7px var(--space-3); border-bottom: 1px solid var(--line); font-size: 11px; }
.mm-log-row time, .mm-log-row span { color: var(--muted); font-family: var(--mono); }
.mm-empty { padding: var(--space-6); color: var(--muted); text-align: center; }

@media (max-width: 1180px) {
  .mm-metrics { grid-template-columns: repeat(3, 1fr); }
  .mm-metrics > div:nth-child(3) { border-right: 0; }
  .mm-metrics > div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .mm-workbench { grid-template-columns: minmax(210px, .8fr) minmax(440px, 1.7fr); }
  .mm-risk { grid-column: 1 / -1; }
  .mm-lower-grid { grid-template-columns: 1fr 1fr; }
  .mm-log { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .mm-header { align-items: flex-start; flex-direction: column; }
  .mm-controls { width: 100%; flex-wrap: wrap; }
  .mm-state { flex: 1 0 100%; }
  .mm-metrics { grid-template-columns: 1fr 1fr; }
  .mm-metrics > div, .mm-metrics > div:nth-child(3) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .mm-metrics > div:nth-child(even) { border-right: 0; }
  .mm-workbench, .mm-lower-grid { grid-template-columns: 1fr; }
  .mm-risk, .mm-log { grid-column: auto; }
  .mm-config { grid-template-columns: 1fr 1fr; }
  .mm-config .button { grid-column: 1 / -1; }
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent 180px),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

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

button,
summary,
select,
input[type="checkbox"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
.table-scroll:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.boot-line {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

body.is-loading .boot-line {
  transform: scaleX(0.72);
  transition: transform 2s cubic-bezier(.2, .8, .2, 1);
}

body.is-ready .boot-line {
  transform: scaleX(1);
  opacity: 0;
  transition: transform .2s ease, opacity .35s ease .2s;
}

.button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .015em;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, transform 80ms ease;
}

.button:active,
.icon-button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: wait;
  opacity: .55;
}

.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.button-primary:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--text);
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--surface-active);
}

.button-quiet {
  border-color: var(--line);
  color: var(--text-soft);
}

.login-screen {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 16px;
}

.pin-form {
  position: relative;
  display: grid;
  width: min(100%, 380px);
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
}

.pin-form #pin-input {
  min-width: 0;
  height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: .45em;
}

.pin-form #pin-input::placeholder {
  color: var(--muted);
  letter-spacing: .12em;
}

.pin-form #pin-input:focus {
  border-color: var(--accent);
}

.pin-form .button {
  min-height: 48px;
  min-width: 96px;
}

.pin-form.is-wrong {
  animation: pin-form-wrong 560ms cubic-bezier(.36, .07, .19, .97);
}

.pin-form.is-wrong #pin-input {
  border-color: var(--danger);
}

.pin-form.is-wrong::before,
.pin-form.is-wrong::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: var(--danger);
  box-shadow:
    -54px -22px var(--danger), 49px -28px var(--warning),
    -68px 13px var(--warning), 62px 18px var(--danger),
    -25px 34px var(--accent), 31px 38px var(--danger);
  content: "";
  pointer-events: none;
  animation: pin-particles 620ms ease-out forwards;
}

.pin-form.is-wrong::after {
  transform: rotate(45deg);
}

.pin-form.is-success {
  animation: pin-form-success 320ms ease-in forwards;
}

.pin-form.is-locked #pin-input {
  border-color: var(--danger);
  color: var(--muted);
}

@keyframes pin-form-wrong {
  0%, 100% { transform: translateX(0) rotate(0); }
  15% { transform: translateX(-10px) rotate(-1deg); }
  30% { transform: translateX(8px) rotate(1deg); }
  45% { transform: translateX(-6px) rotate(-.6deg); }
  60% { transform: translateX(5px) rotate(.5deg); }
  75% { transform: translateX(-2px); }
}

@keyframes pin-particles {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(.2); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); }
}

@keyframes pin-form-success {
  0% { opacity: 1; transform: scale(1); }
  55% { opacity: 1; transform: scale(1.035); }
  100% { opacity: 0; transform: scale(.96); }
}

.terminal {
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  min-height: var(--header-height);
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-4);
  border-bottom: 1px solid var(--line);
  background: rgba(11, 16, 20, .96);
  padding: 0 clamp(16px, 2.4vw, 36px);
}

.brand {
  display: inline-flex;
  width: max-content;
  align-items: center;
  gap: var(--space-3);
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}

.brand-copy {
  display: grid;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 14px;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.process-state {
  display: inline-flex;
  align-items: center;
  color: var(--text-soft);
}

.process-state.is-offline {
  color: var(--danger);
}

.topbar-separator {
  width: 1px;
  height: 16px;
  background: var(--line);
}

.logout-button {
  justify-self: end;
}

.workspace {
  width: min(100%, 1920px);
  margin: 0 auto;
  padding: clamp(16px, 2.2vw, 32px);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--surface);
}

.metric {
  position: relative;
  display: grid;
  min-height: 96px;
  align-content: center;
  gap: 2px;
  border-right: 1px solid var(--line);
  padding: var(--space-4) var(--space-5);
}

.metric:last-child {
  border-right: 0;
}

.metric::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--line-strong);
  content: "";
}

.metric-primary::before {
  background: var(--accent);
}

.metric-danger::before {
  background: var(--danger);
}

.metric-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.metric strong {
  font-family: var(--mono);
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: -.04em;
}

.metric small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-panel {
  border: 1px solid var(--line);
  border-top-color: var(--line-strong);
  background: var(--surface);
}

.panel-heading {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  border-bottom: 1px solid var(--line);
  padding: var(--space-5);
}

.panel-heading h1 {
  margin: 0;
  font-size: clamp(21px, 2vw, 28px);
  line-height: 1.05;
  letter-spacing: -.025em;
}

.panel-heading-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.panel-heading-meta span + span {
  border-left: 1px solid var(--line);
  padding-left: var(--space-4);
}

.command-bar {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(140px, 190px) auto;
  gap: var(--space-3);
  align-items: end;
  border-bottom: 1px solid var(--line);
  padding: var(--space-4) var(--space-5);
}

.field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.field > span,
.range-field legend {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.field input,
.field select,
.range-field input {
  width: 100%;
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0 10px;
  color: var(--text);
}

.field input::placeholder,
.range-field input::placeholder {
  color: #667680;
}

.field input:hover,
.field select:hover,
.range-field input:hover {
  border-color: var(--line-strong);
}

.field input:focus,
.field select:focus,
.range-field input:focus {
  border-color: var(--accent);
  outline: 0;
}

.search-field input,
.margin-field input,
.range-field input,
.age-field input {
  font-family: var(--mono);
  font-size: 12px;
}

.command-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.mobile-sort-bar {
  display: none;
}

.filter-panel {
  display: grid;
  gap: var(--space-4);
  border-bottom: 1px solid var(--line-strong);
  background: #0e1519;
  padding: var(--space-4) var(--space-5) var(--space-5);
}

.filter-panel.is-collapsed {
  display: none;
}

.filter-grid {
  display: grid;
  gap: var(--space-3);
}

.filter-grid-selects {
  grid-template-columns: repeat(4, minmax(130px, 1fr)) minmax(155px, 1fr) minmax(150px, .85fr);
  align-items: end;
}

.filter-grid-ranges {
  grid-template-columns: repeat(5, minmax(170px, 1fr)) minmax(130px, .65fr);
  align-items: end;
}

.filter-select {
  position: relative;
  min-width: 0;
}

.filter-select summary {
  display: grid;
  height: 49px;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0 28px 0 10px;
  list-style: none;
}

.filter-select summary::-webkit-details-marker {
  display: none;
}

.filter-select summary::after {
  position: absolute;
  top: 21px;
  right: 11px;
  width: 6px;
  height: 6px;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  content: "";
  transform: rotate(45deg);
  transition: transform 120ms ease;
}

.filter-select[open] summary {
  border-color: var(--accent);
}

.filter-select[open] summary::after {
  top: 23px;
  transform: rotate(225deg);
}

.filter-select summary span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.filter-select summary strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.option-list {
  position: absolute;
  top: calc(100% + 4px);
  z-index: 20;
  display: grid;
  width: max(100%, 190px);
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  background: var(--surface-raised);
  box-shadow: 0 18px 36px rgba(0, 0, 0, .38);
  padding: var(--space-1);
}

.option-list label,
.check-field {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 8px;
  color: var(--text-soft);
  font-size: 11px;
}

.option-list label:hover {
  background: var(--surface-active);
}

.option-list input,
.check-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.option-list label::before,
.check-box {
  display: grid;
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--accent-ink);
  content: "";
  font-family: var(--mono);
  font-size: 10px;
}

.option-list label:has(input:checked)::before,
.check-field input:checked + .check-box {
  border-color: var(--accent);
  background: var(--accent);
  content: "✓";
}

.check-field input:focus-visible + .check-box {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.fresh-field {
  height: 49px;
  border: 1px solid var(--line);
  background: var(--bg);
}

.fresh-field > span:last-child {
  display: grid;
  min-width: 0;
}

.fresh-field strong {
  font-size: 11px;
  font-weight: 600;
}

.fresh-field small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-field select,
.compact-field input {
  height: 30px;
  font-size: 11px;
}

.range-field {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin: 0;
  border: 0;
  padding: 0;
}

.range-field legend {
  grid-column: 1 / -1;
  margin-bottom: 6px;
  padding: 0;
}

.range-field input {
  height: 30px;
  padding: 0 8px;
  font-size: 11px;
}

.range-field > span {
  color: var(--muted);
  font-size: 9px;
}

.table-scroll {
  position: relative;
  width: 100%;
  max-height: calc(100dvh - 360px);
  min-height: 300px;
  overflow: auto;
  scrollbar-color: var(--line-strong) var(--surface);
  scrollbar-width: thin;
}

.opportunity-table {
  width: 100%;
  min-width: 1200px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 11px;
}

.opportunity-table th,
.opportunity-table td {
  overflow: hidden;
  height: 39px;
  border-bottom: 1px solid rgba(39, 52, 60, .78);
  padding: 0 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opportunity-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 38px;
  border-bottom-color: var(--line-strong);
  background: #121a1f;
  color: var(--muted);
}

.opportunity-table th button {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .055em;
  text-align: inherit;
  text-transform: uppercase;
}

.opportunity-table th button:hover {
  color: var(--text);
}

.opportunity-table th button[data-direction]::after {
  color: var(--accent-strong);
  content: attr(data-indicator);
  font-size: 9px;
}

.opportunity-table tbody tr {
  background: var(--surface);
  cursor: pointer;
}

.opportunity-table tbody tr:nth-child(even) {
  background: #11191e;
}

.opportunity-table tbody tr:hover,
.opportunity-table tbody tr:focus-visible {
  background: var(--surface-active);
  outline: 0;
}

.opportunity-table tbody tr.is-stale td {
  color: var(--muted);
}

.opportunity-table th:nth-child(1),
.opportunity-table td:nth-child(1) { width: 92px; }
.opportunity-table th:nth-child(2),
.opportunity-table td:nth-child(2) { width: 126px; }
.opportunity-table th:nth-child(3),
.opportunity-table td:nth-child(3) { width: 112px; }
.opportunity-table th:nth-child(4),
.opportunity-table td:nth-child(4) { width: 92px; }
.opportunity-table th:nth-child(5),
.opportunity-table td:nth-child(5) { width: 202px; }
.opportunity-table th:nth-child(6),
.opportunity-table td:nth-child(6) { width: 85px; }
.opportunity-table th:nth-child(7),
.opportunity-table td:nth-child(7) { width: 74px; }
.opportunity-table th:nth-child(8),
.opportunity-table td:nth-child(8) { width: 112px; }
.opportunity-table th:nth-child(9),
.opportunity-table td:nth-child(9) { width: 105px; }
.opportunity-table th:nth-child(10),
.opportunity-table td:nth-child(10) { width: 112px; }
.opportunity-table th:nth-child(11),
.opportunity-table td:nth-child(11) { width: 90px; }

.opportunity-table .number-cell,
.opportunity-table td.number-cell {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.opportunity-table .number-cell button {
  justify-content: flex-end;
}

.sticky-column {
  left: 0;
  z-index: 6 !important;
  box-shadow: 1px 0 var(--line);
}

td.sticky-column {
  position: sticky;
  z-index: 2 !important;
  background: inherit;
}

.symbol-cell {
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.value-positive {
  color: var(--accent-strong) !important;
}

.value-danger {
  color: var(--danger) !important;
}

.value-warning {
  color: var(--warning) !important;
}

.status-text {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 650;
}

.status-opportunity { color: var(--accent-strong); }
.status-error { color: var(--danger); }
.status-zero { color: var(--warning); }
.status-pending { color: var(--info); }

.exchange-list {
  display: flex;
  gap: 5px;
}

.exchange-list span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.exchange-list span + span::before {
  margin-right: 5px;
  color: var(--line-strong);
  content: "/";
}

.exchange-list .exchange-state.is-available {
  color: var(--success);
}

.exchange-list .exchange-state.is-error {
  color: var(--danger);
}

.exchange-list .exchange-state.is-pending {
  color: var(--muted);
}

.table-state {
  border-bottom: 1px solid var(--line);
  padding: 11px var(--space-5);
  background: rgba(199, 101, 105, .08);
  color: var(--danger);
  font-size: 11px;
}

.empty-row td {
  height: 220px !important;
  color: var(--muted);
  font-family: var(--sans) !important;
  text-align: center !important;
}

.skeleton-row td::after {
  display: block;
  width: 70%;
  height: 9px;
  background: var(--surface-active);
  content: "";
  animation: skeleton 1.25s ease-in-out infinite alternate;
}

.panel-footer {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  border-top: 1px solid var(--line-strong);
  padding: 0 var(--space-5);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(4, 7, 9, .72);
}

.detail-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 50;
  display: grid;
  width: min(620px, 94vw);
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-left: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: -24px 0 64px rgba(0, 0, 0, .45);
  transform: translateX(101%);
  transition: transform 180ms cubic-bezier(.2, .8, .2, 1);
}

.detail-drawer.is-open {
  transform: translateX(0);
}

.drawer-header,
.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  border-bottom: 1px solid var(--line);
  padding: var(--space-4) var(--space-5);
}

.drawer-header h2 {
  margin: 5px 0 0;
  font-family: var(--mono);
  font-size: 25px;
  letter-spacing: -.035em;
}

.icon-button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0 10px;
  color: var(--text-soft);
  font-size: 11px;
}

.drawer-content {
  overflow-y: auto;
  padding: var(--space-5);
}

.drawer-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.drawer-footer > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
}

.detail-summary div {
  display: grid;
  gap: 4px;
  border-right: 1px solid var(--line);
  padding: var(--space-3);
}

.detail-summary div:last-child {
  border-right: 0;
}

.detail-summary span,
.detail-section-title {
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.detail-summary strong {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-section-title {
  margin: var(--space-6) 0 var(--space-2);
}

.quote-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.quote-table th,
.quote-table td {
  height: 38px;
  border-bottom: 1px solid var(--line);
  padding: 0 8px;
  text-align: right;
  white-space: nowrap;
}

.quote-table th {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.quote-table th:first-child,
.quote-table td:first-child {
  padding-left: 0;
  text-align: left;
}

.detail-note {
  margin: var(--space-4) 0 0;
  border-left: 2px solid var(--line-strong);
  padding: var(--space-2) var(--space-3);
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.detail-note.is-error {
  border-color: var(--danger);
  color: var(--danger);
}

.detail-loading {
  display: grid;
  gap: var(--space-3);
}

.detail-loading span {
  height: 38px;
  background: var(--surface-active);
  animation: skeleton 1.25s ease-in-out infinite alternate;
}

.toast {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: 80;
  max-width: min(380px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  background: var(--surface-raised);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .42);
  padding: 11px 14px;
  color: var(--text-soft);
  font-size: 11px;
}

.toast.is-error {
  border-left-color: var(--danger);
}

@keyframes skeleton {
  from { opacity: .45; }
  to { opacity: 1; }
}

@media (max-width: 1400px) {
  .filter-grid-selects {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .filter-grid-ranges {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
  }

  .table-scroll {
    max-height: calc(100dvh - 440px);
  }
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topbar-status {
    order: 3;
    grid-column: 1 / -1;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding: 7px 0;
  }

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

  .metric:nth-child(2) {
    border-right: 0;
  }

  .metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .command-bar {
    grid-template-columns: minmax(0, 1fr) minmax(140px, .45fr);
  }

  .command-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .filter-grid-selects,
  .filter-grid-ranges {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-scroll {
    max-height: none;
    min-height: 360px;
  }
}

@media (max-width: 1280px) {
  :root {
    --header-height: 54px;
  }

  body {
    font-size: 13px;
  }

  .topbar {
    gap: var(--space-2);
    padding-inline: 12px;
  }

  .logout-button {
    min-height: 32px;
  }

  .workspace {
    padding: 10px;
  }

  .metric {
    min-height: 82px;
    padding: 12px;
  }

  .metric strong {
    font-size: 21px;
  }

  .panel-heading {
    display: grid;
    min-height: 0;
    padding: 16px;
  }

  .panel-heading-meta {
    justify-content: space-between;
  }

  .command-bar {
    grid-template-columns: minmax(0, 1fr) 118px;
    padding: 12px;
  }

  .command-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .command-actions .button {
    min-width: 0;
    padding-inline: 8px;
  }

  .filter-panel {
    padding: 12px;
  }

  .mobile-sort-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: var(--space-2);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    padding: 12px;
  }

  .mobile-sort-bar .button {
    min-height: 30px;
  }

  .filter-grid-selects,
  .filter-grid-ranges {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-select .option-list {
    position: static;
    width: 100%;
    max-height: none;
    border-top: 0;
    box-shadow: none;
  }

  .panel-footer {
    display: grid;
    min-height: 50px;
    align-content: center;
    padding-block: 8px;
  }

  .table-scroll {
    min-height: 280px;
    overflow-x: hidden;
    padding: 10px;
  }

  .opportunity-table {
    display: block;
    width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  .opportunity-table thead {
    display: none;
  }

  .opportunity-table tbody {
    display: grid;
    gap: 10px;
  }

  .opportunity-table tbody tr {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--line);
    background: var(--surface-raised);
  }

  .opportunity-table tbody tr:nth-child(even) {
    background: var(--surface-raised);
  }

  .opportunity-table tbody tr:hover,
  .opportunity-table tbody tr:focus-visible {
    border-color: var(--line-strong);
    background: var(--surface-active);
  }

  .opportunity-table tbody td,
  .opportunity-table tbody td:nth-child(n) {
    position: static;
    display: grid;
    width: auto;
    height: auto;
    min-height: 50px;
    align-content: center;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    overflow: visible;
    text-align: left;
    text-overflow: clip;
    white-space: normal;
    box-shadow: none;
  }

  .opportunity-table tbody td:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  .opportunity-table tbody td:nth-child(5) {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .opportunity-table tbody td:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .opportunity-table tbody td::before {
    color: var(--muted);
    content: attr(data-label);
    font-family: var(--sans);
    font-size: 9px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .opportunity-table tbody .symbol-cell {
    font-size: 15px;
  }

  .opportunity-table tbody .number-cell {
    text-align: left;
  }

  .exchange-list {
    flex-wrap: wrap;
  }

  .empty-row {
    display: block !important;
  }

  .empty-row td {
    display: grid !important;
    grid-column: 1 / -1;
    min-height: 180px !important;
    border: 0 !important;
  }

  .skeleton-row td:nth-child(n + 5) {
    display: none;
  }

  .empty-row td::before,
  .skeleton-row td::before {
    display: none;
  }

  .detail-drawer {
    width: 100vw;
    border-left: 0;
  }

  .drawer-header,
  .drawer-content,
  .drawer-footer {
    padding-inline: 14px;
  }

  .drawer-footer {
    display: grid;
    align-items: stretch;
  }

  .drawer-footer > span {
    align-self: center;
  }

  .detail-summary {
    grid-template-columns: 1fr;
  }

  .detail-summary div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .detail-summary div:last-child {
    border-bottom: 0;
  }

  .quote-table {
    display: block;
    font-size: 10px;
  }

  .quote-table thead {
    display: none;
  }

  .quote-table tbody {
    display: grid;
    gap: 8px;
  }

  .quote-table tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--line);
  }

  .quote-table td,
  .quote-table td:first-child {
    display: grid;
    height: auto;
    min-height: 50px;
    align-content: center;
    gap: 4px;
    border-right: 1px solid var(--line);
    padding: 8px;
    text-align: left;
  }

  .quote-table td:nth-child(1) {
    grid-column: 1 / -1;
    border-right: 0;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
  }

  .quote-table td:nth-child(3),
  .quote-table td:nth-child(5) {
    border-right: 0;
  }

  .quote-table td:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .quote-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-family: var(--sans);
    font-size: 8px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
}

/* The instrument drawer can live on either desktop edge. */
.drawer-title {
  order: 2;
  min-width: 0;
  flex: 1 1 auto;
}

.drawer-title h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-side-toggle {
  position: relative;
  order: 1;
  display: grid;
  width: 36px;
  min-width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
  color: var(--accent);
}

.drawer-side-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 280ms cubic-bezier(.22, 1, .36, 1);
}

.drawer-close {
  order: 3;
}

.detail-drawer.is-left .drawer-title {
  order: 1;
}

.detail-drawer.is-left .drawer-close {
  order: 2;
}

.detail-drawer.is-left .drawer-side-toggle {
  order: 3;
}

.detail-drawer.is-left .drawer-side-toggle svg {
  transform: rotate(180deg);
}

.detail-drawer.is-open.is-left {
  box-shadow: 24px 0 64px rgba(45, 51, 67, .18);
  transform: translateX(calc(-100vw + 100% + 20px));
}

.detail-drawer.is-side-switching {
  transition-duration: 560ms;
  transition-timing-function: cubic-bezier(.22, 1, .36, 1);
}

.detail-drawer::after {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: linear-gradient(
    105deg,
    transparent 34%,
    rgba(255, 255, 255, .42) 48%,
    rgba(82, 110, 232, .08) 52%,
    transparent 66%
  );
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: translateX(-130%);
}

.detail-drawer.is-side-switching::after {
  animation: drawer-side-sheen 560ms cubic-bezier(.22, 1, .36, 1);
}

@keyframes drawer-side-sheen {
  0% { opacity: 0; transform: translateX(-130%); }
  22% { opacity: 1; }
  100% { opacity: 0; transform: translateX(130%); }
}

@media (max-width: 700px) {
  .drawer-side-toggle {
    display: none;
  }

  .detail-drawer.is-open.is-left {
    box-shadow: var(--shadow-float);
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .detail-drawer.is-side-switching {
    transition-duration: 1ms;
  }

  .detail-drawer.is-side-switching::after {
    animation: none;
  }
}

@media (min-width: 821px) and (max-width: 1280px) {
  .workspace {
    padding: clamp(16px, 2vw, 24px);
  }

  .panel-heading {
    display: flex;
  }

  .command-bar {
    grid-template-columns: minmax(200px, 1fr) minmax(150px, 190px) auto;
  }

  .command-actions {
    grid-column: auto;
    display: flex;
    width: auto;
  }

  .filter-grid-selects,
  .filter-grid-ranges {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-select .option-list {
    position: absolute;
    width: max(100%, 190px);
    max-height: 260px;
    border-top: 1px solid var(--line-strong);
    box-shadow: 0 18px 36px rgba(0, 0, 0, .38);
  }

  .opportunity-table tbody {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-drawer {
    width: min(620px, 94vw);
    border-left: 1px solid var(--line-strong);
  }
}

@media (max-width: 350px) {
  .workspace {
    padding: 6px;
  }

  .filter-grid-selects,
  .filter-grid-ranges {
    grid-template-columns: 1fr;
  }

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

  .margin-field,
  .command-actions {
    grid-column: 1;
  }

  .command-actions {
    grid-template-columns: 1fr 1fr;
  }

  .refresh-button {
    grid-column: 1 / -1;
  }

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

  .pin-form {
    grid-template-columns: minmax(0, 1fr) 88px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Local redesign: macOS-inspired workspace with a single soft shape system. */
:root {
  color-scheme: light;
  --bg: #f2f3f6;
  --surface: #ffffff;
  --surface-raised: #f8f9fb;
  --surface-active: #eef1f7;
  --line: #e2e5eb;
  --line-strong: #cfd4de;
  --text: #202124;
  --text-soft: #4e535d;
  --muted: #7a818d;
  --accent: #526ee8;
  --accent-strong: #415bd0;
  --accent-ink: #ffffff;
  --warning: #a66a21;
  --danger: #c64752;
  --info: #50718b;
  --success: #287b5b;
  --space-sm: clamp(8px, .7vw, 12px);
  --space-md: clamp(12px, 1vw, 16px);
  --space-lg: clamp(16px, 1.4vw, 24px);
  --radius: 10px;
  --radius-panel: 18px;
  --shadow-panel: 0 14px 38px rgba(48, 56, 76, .07), 0 2px 8px rgba(48, 56, 76, .04);
  --shadow-float: 0 28px 80px rgba(38, 45, 62, .18), 0 8px 24px rgba(38, 45, 62, .08);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  --header-height: 68px;
}

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

body {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .72), transparent 320px);
  color: var(--text);
  font-size: 14px;
}

.layout-stack {
  display: grid;
  gap: var(--space-md);
}

.layout-stack-tight {
  gap: 5px;
}

.button {
  min-height: 40px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -.01em;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 100ms ease, box-shadow 160ms ease;
}

.button:active,
.icon-button:active {
  transform: scale(.98);
}

.button-primary {
  box-shadow: 0 5px 14px rgba(82, 110, 232, .22);
}

.button-primary:hover:not(:disabled) {
  box-shadow: 0 7px 18px rgba(82, 110, 232, .28);
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
}

.button-danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.button-danger:hover:not(:disabled) {
  background: #ad3641;
}

.button-text-danger {
  border-color: transparent;
  background: transparent;
  color: var(--danger);
}

.button-text-danger:hover:not(:disabled) {
  background: rgba(198, 71, 82, .08);
}

.topbar {
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 22px;
  border-bottom: 1px solid rgba(205, 210, 220, .8);
  background: rgba(250, 251, 252, .88);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9);
  padding-inline: clamp(14px, 2.5vw, 36px);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  box-shadow: 0 5px 14px rgba(82, 110, 232, .2);
  font-family: var(--sans);
}

.brand-copy strong {
  font-size: 15px;
  letter-spacing: -.02em;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #eceef3;
  padding: 3px;
}

.nav-tab {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  padding: 0 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.is-active {
  background: var(--surface);
  box-shadow: 0 2px 7px rgba(45, 51, 67, .1);
  color: var(--text);
}

.nav-count {
  min-width: 16px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
}

.topbar-status {
  justify-self: end;
  overflow: hidden;
  font-family: var(--sans);
  font-size: 11px;
  white-space: nowrap;
}

.process-state.is-online {
  color: var(--text-soft);
}

.workspace {
  width: min(100%, 1600px);
  padding: clamp(14px, 2.2vw, 30px);
}

.app-view.is-active {
  animation: view-enter 220ms cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.metrics {
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--line);
  box-shadow: var(--shadow-panel);
}

.metric {
  min-height: 100px;
  border: 0;
  background: var(--surface);
  padding: 18px 20px;
}

.metric::before {
  display: none;
}

.metric-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.metric strong {
  font-family: var(--sans);
  font-size: 28px;
  font-weight: 720;
  letter-spacing: -.04em;
}

.metric small {
  font-size: 11px;
}

.screen-panel {
  overflow: hidden;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.panel-heading {
  min-height: 86px;
  padding: 20px;
}

.panel-heading h1,
.favorites-heading h1 {
  font-size: clamp(24px, 2.2vw, 34px);
  font-weight: 720;
  letter-spacing: -.045em;
}

.panel-heading-meta {
  font-family: var(--sans);
  font-size: 11px;
}

.command-bar,
.filter-panel,
.mobile-sort-bar {
  background: var(--surface-raised);
}

.field > span,
.range-field legend {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.field input,
.field select,
.range-field input,
.comment-field textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.field input:hover,
.field select:hover,
.range-field input:hover,
.comment-field textarea:hover {
  border-color: var(--line-strong);
}

.field input:focus,
.field select:focus,
.range-field input:focus,
.comment-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(82, 110, 232, .12);
  outline: 0;
}

.filter-select,
.check-field,
.range-field {
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.option-list {
  border-color: var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 34px rgba(45, 51, 67, .13);
}

.table-scroll {
  background: var(--surface);
}

.opportunity-table th {
  background: #f7f8fa;
  color: #6e7581;
}

.opportunity-table tbody tr:nth-child(even) {
  background: #fbfcfd;
}

.opportunity-table tbody tr:hover,
.opportunity-table tbody tr:focus-visible {
  background: #f0f3fb;
}

.opportunity-table tbody tr.is-unresolved:not(:hover):not(:focus-visible) {
  background: #fafbfc;
}

.opportunity-table tbody tr.is-unresolved:not(:hover):not(:focus-visible) td {
  color: var(--muted);
}

.status-opportunity,
.value-positive {
  color: var(--success);
}

.panel-footer {
  background: var(--surface-raised);
  font-family: var(--sans);
  font-size: 10px;
}

.drawer-backdrop {
  background: rgba(42, 46, 57, .32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.detail-drawer {
  inset: 10px 10px 10px auto;
  width: min(760px, 94vw);
  height: calc(100dvh - 20px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 22px;
  background: rgba(252, 252, 253, .97);
  box-shadow: var(--shadow-float);
}

.drawer-header h2 {
  margin: 0;
  font-family: var(--sans);
  font-size: 27px;
  font-weight: 720;
}

.drawer-header,
.drawer-footer {
  background: rgba(255, 255, 255, .76);
}

.icon-button {
  min-height: 36px;
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--text-soft);
  font-size: 12px;
}

.drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-summary {
  overflow: hidden;
  border-color: var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.detail-summary div {
  border-color: var(--line);
  padding: 14px;
}

.detail-summary span,
.detail-section-title {
  letter-spacing: 0;
  text-transform: none;
}

.detail-note {
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-active);
  padding: 12px;
}

.liquidity-section {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.liquidity-section > header {
  display: grid;
  gap: 4px;
}

.liquidity-section h3,
.liquidity-section p {
  margin: 0;
}

.liquidity-section h3 {
  color: var(--text);
  font-size: 16px;
  letter-spacing: -.02em;
}

.liquidity-section > header p {
  color: var(--muted);
  font-size: 11px;
}

.liquidity-list,
.liquidity-loading {
  display: grid;
  gap: 12px;
}

.liquidity-exchange,
.liquidity-loading-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.liquidity-exchange > header {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}

.liquidity-exchange-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.liquidity-exchange-identity img {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  object-fit: contain;
}

.liquidity-exchange-identity > div {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.liquidity-exchange-identity strong {
  font-size: 13px;
}

.liquidity-exchange-identity span {
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.liquidity-best {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(92px, .7fr) minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
}

.liquidity-best-metric {
  display: grid;
  min-width: 0;
  gap: 2px;
  border-right: 1px solid var(--line);
  padding: 10px 12px;
  font-variant-numeric: tabular-nums;
}

.liquidity-best-metric:last-child {
  border-right: 0;
}

.liquidity-best-metric span,
.liquidity-best-metric small {
  color: var(--muted);
  font-size: 9px;
}

.liquidity-best-metric strong {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.liquidity-best-metric.is-bid strong,
.liquidity-band-value.is-bid {
  color: var(--success);
}

.liquidity-best-metric.is-ask strong,
.liquidity-band-value.is-ask {
  color: var(--danger);
}

.liquidity-best-metric.is-spread {
  text-align: center;
}

.liquidity-matrix {
  display: grid;
  padding: 8px 12px 12px;
}

.liquidity-matrix-header,
.liquidity-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr);
  align-items: center;
}

.liquidity-matrix-header {
  min-height: 28px;
  color: var(--muted);
  font-size: 9px;
}

.liquidity-matrix-header span:first-child {
  text-align: right;
}

.liquidity-matrix-header span:nth-child(2) {
  text-align: center;
}

.liquidity-band {
  min-height: 34px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.liquidity-band-value {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 26px;
  align-items: center;
  overflow: hidden;
  padding: 0 8px;
}

.liquidity-band-value::before {
  position: absolute;
  z-index: -1;
  top: 3px;
  bottom: 3px;
  width: var(--liquidity-fill);
  content: "";
}

.liquidity-band-value.is-bid {
  justify-items: end;
  text-align: right;
}

.liquidity-band-value.is-bid::before {
  right: 0;
  background: rgba(40, 123, 91, .11);
}

.liquidity-band-value.is-ask::before {
  left: 0;
  background: rgba(198, 71, 82, .10);
}

.liquidity-radius {
  color: var(--text-soft);
  text-align: center;
  white-space: nowrap;
}

.liquidity-exchange-error,
.liquidity-error {
  padding: 14px;
  color: var(--danger);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.liquidity-loading-card {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.liquidity-loading-card span {
  height: 30px;
  border-radius: 8px;
  background: var(--surface-active);
  animation: skeleton 1.25s ease-in-out infinite alternate;
}

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

.favorites-heading {
  display: flex;
  min-height: 132px;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
  padding: clamp(20px, 3vw, 34px);
}

.favorites-heading h1,
.favorites-heading p {
  margin: 0;
}

.favorites-heading p {
  max-width: 560px;
  color: var(--muted);
}

.favorites-summary {
  display: grid;
  justify-items: end;
}

.favorites-summary strong {
  color: var(--accent);
  font-size: 40px;
  line-height: 1;
  letter-spacing: -.06em;
}

.favorites-summary span {
  color: var(--muted);
  font-size: 12px;
}

.favorites-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 520px) auto;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-md);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .76);
  padding: 14px;
}

.favorites-grid {
  columns: 3 300px;
  column-gap: 16px;
}

.favorite-card {
  display: grid;
  break-inside: avoid;
  gap: 18px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(48, 56, 76, .055);
  padding: 18px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.favorite-card:hover {
  border-color: #cfd5e5;
  box-shadow: 0 16px 36px rgba(48, 56, 76, .09);
  transform: translateY(-2px);
}

.favorite-card header h2,
.favorite-card header span,
.favorite-comment,
.favorite-metrics,
.favorite-metrics dd {
  margin: 0;
}

.favorite-card header h2 {
  font-size: 21px;
  letter-spacing: -.035em;
}

.favorite-card header span {
  color: var(--muted);
  font-size: 10px;
}

.favorite-comment {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

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

.favorite-metrics div {
  display: grid;
  min-width: 0;
  gap: 3px;
  border-radius: 9px;
  background: var(--surface-raised);
  padding: 9px;
}

.favorite-metrics dt {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-metrics dd {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-card footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.favorite-card footer .button:first-child {
  flex: 1;
}

.favorites-empty {
  display: grid;
  min-height: 320px;
  place-content: center;
  justify-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  padding: 32px;
  text-align: center;
}

.favorites-empty strong {
  font-size: 22px;
}

.favorites-empty p {
  max-width: 440px;
  margin: 0 0 8px;
  color: var(--muted);
}

.modal-dialog {
  width: min(560px, calc(100vw - 28px));
  max-width: none;
  max-height: min(760px, calc(100dvh - 28px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  padding: 0;
  color: var(--text);
}

.modal-dialog::backdrop {
  background: rgba(42, 46, 57, .32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-dialog-compact {
  width: min(440px, calc(100vw - 28px));
}

.modal-panel {
  display: grid;
  max-height: inherit;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.modal-header,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 18px 20px;
}

.modal-header {
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 23px;
  letter-spacing: -.035em;
}

.modal-body {
  overflow-y: auto;
  padding: 20px;
}

.modal-copy {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.comment-field textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
}

.comment-field textarea::placeholder {
  color: #999faa;
}

.comment-meta {
  display: flex;
  min-height: 20px;
  justify-content: space-between;
  gap: var(--space-md);
  color: var(--muted);
  font-size: 11px;
}

#favorite-form-error {
  color: var(--danger);
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  background: var(--surface-raised);
}

.toast {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow-float);
  color: var(--text-soft);
}

.login-screen {
  background: radial-gradient(circle at 50% 42%, rgba(82, 110, 232, .08), transparent 280px);
}

.pin-form {
  border: 1px solid rgba(255, 255, 255, .86);
  border-radius: 16px;
  background: rgba(255, 255, 255, .78);
  box-shadow: var(--shadow-panel);
  padding: 8px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.pin-form #pin-input {
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

@media (max-width: 1000px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
    row-gap: 8px;
    padding-block: 8px;
  }

  .primary-nav {
    justify-self: center;
  }

  .topbar-status {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    justify-content: center;
  }

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

  .metric {
    min-height: 88px;
  }

  .favorites-grid {
    columns: 2 280px;
  }
}

@media (max-width: 640px) {
  :root {
    --header-height: auto;
    --radius-panel: 15px;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    gap: 8px;
  }

  .primary-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
  }

  .topbar-status {
    grid-column: 1 / -1;
    grid-row: 3;
    min-width: 0;
    overflow: hidden;
  }

  .brand-copy {
    display: none;
  }

  .primary-nav {
    width: 100%;
  }

  .nav-tab {
    flex: 1;
    justify-content: center;
    padding-inline: 8px;
  }

  .logout-button {
    min-height: 36px;
    padding-inline: 9px;
  }

  .workspace {
    padding: 10px;
  }

  .metrics {
    border-radius: var(--radius-panel);
  }

  .metric {
    padding: 14px;
  }

  .metric strong {
    font-size: 23px;
  }

  .screen-panel {
    margin-top: 10px;
  }

  .favorites-heading {
    min-height: 0;
    align-items: start;
    padding: 20px;
  }

  .favorites-summary strong {
    font-size: 32px;
  }

  .favorites-toolbar {
    grid-template-columns: 1fr;
  }

  .favorites-grid {
    columns: 1;
  }

  .favorite-card {
    margin-bottom: 10px;
    border-radius: var(--radius-panel);
  }

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

  .favorite-metrics div:last-child {
    grid-column: 1 / -1;
  }

  .detail-drawer {
    inset: 0;
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .drawer-footer {
    align-items: stretch;
  }

  .drawer-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .liquidity-best {
    grid-template-columns: minmax(0, 1fr) 84px minmax(0, 1fr);
  }

  .liquidity-best-metric {
    padding: 9px 8px;
  }

  .liquidity-matrix {
    padding-inline: 8px;
  }

  .liquidity-matrix-header,
  .liquidity-band {
    grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
  }

  .modal-dialog {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
    border-radius: 18px;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 16px;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar,
  .pin-form,
  .detail-drawer,
  .modal-dialog,
  .toast {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* Compact trading controls */
.login-shell {
  display: grid;
  width: min(100%, 380px);
  justify-items: center;
  gap: var(--space-lg);
}

.login-logo {
  width: 128px;
  height: 128px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 18px 42px rgba(52, 62, 86, .14);
}

.login-shell .pin-form {
  width: 100%;
}

.brand-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid rgba(205, 210, 220, .84);
  border-radius: 11px;
  background: var(--surface);
  object-fit: cover;
  box-shadow: 0 5px 14px rgba(52, 62, 86, .12);
}

.listings-nav-badge {
  display: inline-grid;
  min-width: 20px;
  height: 18px;
  place-items: center;
  border: 1px solid rgba(104, 178, 147, .48);
  border-radius: 999px;
  background: rgba(79, 149, 123, .14);
  padding: 0 5px;
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 750;
  line-height: 1;
}

.screen-panel {
  margin-top: 0;
}

.filter-panel {
  display: grid;
  gap: var(--space-md);
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
  padding: 16px 20px 20px;
}

.filter-essentials {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(138px, 150px) minmax(145px, 170px) minmax(150px, 180px) auto;
  align-items: end;
  gap: var(--space-md);
}

.exchange-picker {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.exchange-picker legend {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
}

.exchange-logo-options {
  display: flex;
  gap: 7px;
}

.exchange-logo-option {
  position: relative;
  display: grid;
  width: 42px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease, transform 80ms ease;
}

.exchange-logo-option:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.exchange-logo-option:active {
  transform: translateY(0);
}

.exchange-logo-option input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.exchange-logo-option img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: grayscale(1);
  opacity: .48;
  transition: filter 120ms ease, opacity 120ms ease, transform 120ms ease;
}

.exchange-logo-option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(82, 110, 232, .09);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.exchange-logo-option:has(input:checked) img {
  filter: none;
  opacity: 1;
  transform: scale(1.04);
}

.exchange-logo-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.exchange-logo-option::after {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 40;
  width: max-content;
  max-width: 140px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 7px;
  background: #2d3340;
  padding: 5px 8px;
  color: #f8f9fb;
  content: attr(data-tooltip);
  font-size: 10px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 3px);
  transition: opacity 100ms ease, transform 100ms ease;
}

.exchange-logo-option:hover::after,
.exchange-logo-option:focus-within::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.limit-field input {
  font-family: var(--mono);
}

.stock-field {
  height: 36px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
  padding-inline: 10px;
}

.stock-field:hover {
  border-color: var(--line-strong);
}

.stock-field > span:last-child {
  display: grid;
  min-width: 0;
}

.stock-field strong {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 650;
}

.stock-field small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.liquid-field:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.turnover-cell {
  color: var(--text-soft);
  font-weight: 680;
}

.turnover-column {
  min-width: 112px;
}

.filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

.position-calculator {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(190px, 260px) minmax(330px, 1fr);
  align-items: stretch;
  gap: var(--space-md);
  border-top: 1px solid var(--line);
  padding-top: var(--space-md);
}

.calculator-margin-field {
  align-content: center;
}

.money-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.money-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(82, 110, 232, .12);
}

.money-input input {
  height: 46px;
  border: 0;
  background: transparent;
  padding: 0 12px;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  outline: 0;
}

.money-input > span {
  padding-right: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.calculator-position {
  display: grid;
  min-width: 0;
  align-content: center;
  justify-items: start;
  gap: 2px;
  border: 1px solid rgba(82, 110, 232, .34);
  border-radius: var(--radius);
  background: rgba(82, 110, 232, .08);
  padding: 9px 13px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, transform 80ms ease;
}

.calculator-position:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(82, 110, 232, .12);
}

.calculator-position:active:not(:disabled) {
  transform: translateY(1px);
}

.calculator-position:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.calculator-position span,
.calculator-position small,
.calculator-breakdown dt {
  color: var(--muted);
  font-size: 10px;
}

.calculator-position strong {
  overflow: hidden;
  max-width: 100%;
  font-family: var(--mono);
  font-size: 21px;
  letter-spacing: -.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calculator-position small {
  line-height: 1.2;
}

.calculator-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.calculator-breakdown div {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 3px;
  border-right: 1px solid var(--line);
  padding: 9px 12px;
}

.calculator-breakdown div:last-child {
  border-right: 0;
}

.calculator-breakdown dd {
  overflow: hidden;
  margin: 0;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calculator-breakdown .calculator-net dd {
  color: var(--success);
}

.position-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-sm);
}

.position-presets button {
  display: flex;
  min-width: 0;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, transform 80ms ease;
}

.position-presets button:hover {
  border-color: var(--line-strong);
}

.position-presets button:active {
  transform: translateY(1px);
}

.position-presets button.is-active {
  border-color: var(--accent);
  background: rgba(82, 110, 232, .09);
  color: var(--accent);
}

.position-presets strong {
  font-family: var(--mono);
  font-size: 13px;
}

.position-presets span {
  color: var(--muted);
  font-size: 10px;
}

.listings-panel {
  margin-top: 0;
}

.listings-heading {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  border-bottom: 1px solid var(--line);
  padding: 20px;
}

.listings-heading h1 {
  margin: 0;
  font-size: clamp(24px, 2.2vw, 34px);
  font-weight: 720;
  letter-spacing: -.045em;
}

.listings-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.listings-heading > span {
  color: var(--muted);
  font-size: 11px;
}

.listings-toolbar {
  display: flex;
  align-items: end;
  gap: var(--space-3);
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
  padding: var(--space-3) var(--space-5);
}

.listings-search-field {
  width: min(340px, 100%);
}

.listings-table {
  min-width: 1142px;
}

.listings-table th:nth-child(1),
.listings-table td:nth-child(1) { width: 170px; }
.listings-table th:nth-child(2),
.listings-table td:nth-child(2) { width: 190px; }
.listings-table th:nth-child(3),
.listings-table td:nth-child(3) { width: 90px; }
.listings-table th:nth-child(4),
.listings-table td:nth-child(4) { width: 110px; }
.listings-table th:nth-child(5),
.listings-table td:nth-child(5) { width: 112px; }
.listings-table th:nth-child(6),
.listings-table td:nth-child(6) { width: 120px; }
.listings-table th:nth-child(7),
.listings-table td:nth-child(7) { width: 230px; }
.listings-table th:nth-child(8),
.listings-table td:nth-child(8) { width: 120px; }

.listings-table tbody tr.is-fresh-listing {
  background: inherit;
  box-shadow: none;
}

.listings-table tbody tr.is-delisted {
  cursor: default;
  opacity: .62;
}

.listing-symbol-wrap {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-2);
}

.listing-symbol-wrap strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-new-badge {
  flex: 0 0 auto;
  transform: rotate(-4deg);
  border: 1px solid #ff7b45;
  border-radius: 3px;
  background: linear-gradient(135deg, #ff5b35, #ff8a3d);
  box-shadow: 0 2px 7px rgba(255, 91, 53, .2);
  padding: 2px 5px 1px;
  color: #fff;
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: .08em;
}

.listing-detected-at,
.listing-age {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.listing-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.listing-status::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.listing-status.is-active {
  color: var(--accent-strong);
}

.listing-status.is-delisted {
  color: var(--danger);
}

@media (max-width: 1400px) {
  .filter-essentials {
    grid-template-columns: minmax(180px, 1fr) auto minmax(138px, 160px) minmax(145px, 170px);
  }

  .filter-actions {
    grid-column: 2 / -1;
  }

  .position-calculator {
    grid-template-columns: minmax(170px, 220px) minmax(190px, 1fr);
  }

  .calculator-breakdown {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .brand-logo {
    width: 38px;
    height: 38px;
  }

  .nav-count {
    display: none;
  }

  .listings-nav-badge {
    min-width: 18px;
    height: 16px;
    padding-inline: 4px;
    font-size: 8px;
  }

  .filter-panel {
    padding: 14px;
  }

  .filter-essentials {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .search-field,
  .limit-field {
    grid-column: 1 / -1;
  }

  .exchange-picker {
    grid-column: 1 / -1;
  }

  .stock-field {
    grid-column: auto;
  }

  .filter-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .position-calculator {
    grid-template-columns: 1fr;
  }

  .calculator-breakdown,
  .calculator-position,
  .calculator-margin-field {
    grid-column: 1;
  }

  .calculator-breakdown dd {
    font-size: 15px;
  }

  .position-presets {
    grid-template-columns: 1fr 1fr;
  }

  .position-presets button {
    justify-content: space-between;
    padding-inline: 12px;
  }

  .listings-heading {
    min-height: 70px;
    padding: 16px;
  }

  .listings-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: var(--space-3) var(--space-4);
  }

  .listings-search-field {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .nav-tab {
    gap: 4px;
    padding-inline: 6px;
    font-size: 11px;
  }

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

  .exchange-picker,
  .stock-field,
  .filter-actions {
    grid-column: 1;
  }

  .exchange-logo-options {
    display: grid;
    grid-template-columns: repeat(4, min(42px, 20vw));
    justify-content: space-between;
  }

  .exchange-logo-option {
    width: min(42px, 20vw);
  }
}

/* Compact advanced order-book controls */
.exchange-logo-options {
  flex-wrap: wrap;
}

.exchange-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface-raised) 88%, var(--text) 12%);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 780;
  letter-spacing: -.04em;
  opacity: .52;
  transition: opacity 120ms ease, transform 120ms ease, color 120ms ease, background-color 120ms ease;
}

.exchange-mark-hyperliquid {
  background: #172e2d;
  color: #8de5d4;
}

.exchange-mark-okx {
  background: #20242c;
  color: #f2f4f7;
}

.exchange-mark-htx {
  background: #1d293d;
  color: #8fbcff;
}

.exchange-logo-option:has(input:checked) .exchange-mark {
  color: var(--text);
  opacity: 1;
  transform: scale(1.04);
}

.advanced-filters {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.advanced-filters summary {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: 0 2px;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
  list-style: none;
}

.advanced-filters summary::-webkit-details-marker {
  display: none;
}

.advanced-filters summary::before {
  display: inline-grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  content: "+";
  font-family: var(--mono);
  font-size: 13px;
}

.advanced-filters summary span {
  margin-right: auto;
}

.advanced-filters summary small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.advanced-filters[open] summary::before {
  content: "−";
}

.advanced-filter-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(180px, .8fr) minmax(150px, .6fr) minmax(150px, .6fr);
  gap: var(--space-md);
  padding: 8px 0 16px;
}

.advanced-filter-grid select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 34px 0 11px;
  color: var(--text);
  font: inherit;
}

.depth-radius-field span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.depth-radius-field output {
  color: var(--text);
  font-family: var(--mono);
}

.depth-radius-field input[type="range"] {
  width: 100%;
  height: 38px;
  margin: 0;
  accent-color: var(--accent);
}

.opportunity-table {
  min-width: 1280px;
}

@media (max-width: 1280px) {
  .opportunity-table {
    min-width: 0;
  }
}

.opportunity-table .depth-column,
.opportunity-table .depth-cell {
  min-width: 150px;
  font-family: var(--mono);
}

.opportunity-table th:nth-child(3),
.opportunity-table td:nth-child(3) {
  width: 190px;
}

.opportunity-table th:nth-child(4),
.opportunity-table td:nth-child(4) {
  width: 160px;
}

.depth-cell {
  color: var(--text-soft);
  font-size: 11px;
}

.liquidity-exchange-identity .exchange-mark {
  opacity: 1;
}

@media (max-width: 900px) {
  .advanced-filter-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .exchange-logo-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(42px, 1fr));
    gap: 5px;
  }

  .exchange-logo-option {
    width: auto;
  }

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

  .advanced-filters summary small {
    display: none;
  }
}

/* Hedge calculator */
.hedge-panel {
  margin-top: 0;
}

.hedge-heading {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  border-bottom: 1px solid var(--line);
  padding: 20px;
}

.hedge-heading h1,
.hedge-heading p {
  margin: 0;
}

.hedge-heading h1 {
  font-size: clamp(24px, 2.2vw, 34px);
  font-weight: 720;
  letter-spacing: -.045em;
}

.hedge-heading p,
.hedge-live-status,
.hedge-search-note {
  color: var(--muted);
  font-size: 11px;
}

.hedge-live-status {
  font-family: var(--mono);
  white-space: nowrap;
}

.hedge-search {
  display: grid;
  grid-template-columns: minmax(150px, .65fr) minmax(310px, 1.35fr) minmax(170px, .75fr) minmax(130px, .5fr) auto;
  align-items: end;
  gap: var(--space-md);
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
  padding: 20px;
}

.hedge-route-field {
  display: grid;
  min-height: 68px;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 9px 12px;
}

.hedge-route-field > span,
.hedge-route-field small,
.hedge-exchange-picker legend {
  color: var(--muted);
  font-size: 10px;
}

.hedge-route-field strong {
  font-size: 16px;
}

.hedge-exchange-picker {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.hedge-exchange-picker legend {
  margin-bottom: 6px;
}

.hedge-exchange-options {
  display: grid;
  grid-template-columns: repeat(7, minmax(36px, 1fr));
  gap: 5px;
}

.hedge-exchange-option {
  position: relative;
  display: grid;
  min-width: 0;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, transform 80ms ease;
}

.hedge-exchange-option:hover {
  border-color: var(--line-strong);
}

.hedge-exchange-option:active {
  transform: translateY(1px);
}

.hedge-exchange-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.hedge-exchange-option img,
.hedge-exchange-option .exchange-mark {
  filter: grayscale(1);
  opacity: .45;
}

.hedge-exchange-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent);
}

.hedge-exchange-option:has(input:checked) img,
.hedge-exchange-option:has(input:checked) .exchange-mark {
  filter: none;
  opacity: 1;
}

.hedge-exchange-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hedge-exchange-option::after {
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  z-index: 30;
  width: max-content;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--text);
  padding: 4px 7px;
  color: var(--surface);
  content: attr(data-tooltip);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 3px);
  transition: opacity 100ms ease, transform 100ms ease;
}

.hedge-exchange-option:hover::after,
.hedge-exchange-option:focus-within::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hedge-margin-field .money-input,
.hedge-leverage-field select {
  min-height: 46px;
}

.hedge-leverage-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 11px;
  font-family: var(--mono);
  font-weight: 700;
}

.hedge-submit {
  min-height: 46px;
  padding-inline: 20px;
}

.hedge-search-note {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  border-bottom: 1px solid var(--line);
  padding: 9px 20px;
}

.hedge-state {
  display: grid;
  min-height: 280px;
  place-items: center;
  padding: 32px 20px;
  text-align: center;
}

.hedge-state > div,
.hedge-state:not(:has(> div)) {
  gap: 6px;
}

.hedge-state p {
  max-width: 520px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.hedge-results {
  display: grid;
}

.hedge-loading {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.hedge-loading span {
  min-height: 96px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-active) 45%, var(--surface) 65%);
  background-size: 300% 100%;
  animation: detail-shimmer 1.25s infinite linear;
}

.hedge-result {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.hedge-result > summary {
  display: grid;
  min-height: 92px;
  grid-template-columns: 32px minmax(130px, .7fr) minmax(190px, .9fr) minmax(420px, 2fr);
  align-items: center;
  gap: var(--space-md);
  padding: 14px 20px;
  cursor: pointer;
  list-style: none;
  transition: background-color 120ms ease;
}

.hedge-result > summary::-webkit-details-marker {
  display: none;
}

.hedge-result > summary:hover,
.hedge-result[open] > summary {
  background: var(--surface-active);
}

.hedge-rank {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

.hedge-result-identity,
.hedge-side,
.hedge-result-metric {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.hedge-result-identity strong {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hedge-result-identity small,
.hedge-side small,
.hedge-result-metric small {
  color: var(--muted);
  font-size: 9px;
}

.hedge-route {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hedge-side {
  border-left: 2px solid var(--line-strong);
  padding-left: 9px;
}

.hedge-side.is-long {
  border-color: var(--success);
}

.hedge-side.is-short {
  border-color: var(--danger);
}

.hedge-result-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
}

.hedge-result-metric {
  align-content: center;
  background: var(--surface);
  padding: 8px 10px;
}

.hedge-result-metric strong,
.hedge-scenario header span {
  font-family: var(--mono);
  font-size: 12px;
}

.hedge-result-metric strong.is-negative,
.hedge-scenario header span.is-negative,
.hedge-leg dd.is-negative {
  color: var(--danger);
}

.hedge-leg dd.is-positive {
  color: var(--success);
}

.hedge-result-body {
  display: grid;
  gap: var(--space-md);
  border-top: 1px solid var(--line);
  background: var(--surface-raised);
  padding: 16px 20px 20px;
}

.hedge-order-grid,
.hedge-scenario-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.hedge-leg,
.hedge-scenario {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.hedge-leg > header,
.hedge-scenario > header {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
}

.hedge-leg > header {
  justify-content: flex-start;
}

.hedge-leg > header img {
  object-fit: contain;
}

.hedge-leg dl,
.hedge-scenario dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.hedge-leg dl > div,
.hedge-scenario dl > div {
  display: grid;
  min-width: 0;
  gap: 3px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}

.hedge-leg dl > div:nth-child(3n),
.hedge-scenario dl > div:nth-child(3n) {
  border-right: 0;
}

.hedge-leg dl > div:nth-last-child(-n + 3),
.hedge-scenario dl > div:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.hedge-leg dt,
.hedge-scenario dt {
  color: var(--muted);
  font-size: 9px;
}

.hedge-leg dd,
.hedge-scenario dd {
  overflow: hidden;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hedge-result-note {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 1180px) {
  .hedge-search {
    grid-template-columns: minmax(150px, .7fr) minmax(300px, 1.4fr) minmax(170px, .7fr);
  }

  .hedge-leverage-field,
  .hedge-submit {
    grid-row: 2;
  }

  .hedge-leverage-field {
    grid-column: 1;
  }

  .hedge-submit {
    grid-column: 2 / 4;
  }

  .hedge-result > summary {
    grid-template-columns: 32px minmax(130px, .7fr) minmax(180px, .9fr);
  }

  .hedge-result-metrics {
    grid-column: 2 / -1;
  }
}

@media (max-width: 760px) {
  .hedge-heading {
    min-height: 70px;
    align-items: flex-start;
    padding: 16px;
  }

  .hedge-live-status {
    padding-top: 5px;
  }

  .hedge-search {
    grid-template-columns: 1fr 1fr;
    padding: 14px;
  }

  .hedge-exchange-picker {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .hedge-margin-field,
  .hedge-leverage-field {
    grid-row: 3;
  }

  .hedge-submit {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  .hedge-search-note {
    display: grid;
    padding-inline: 14px;
  }

  .hedge-result > summary {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    padding: 13px 14px;
  }

  .hedge-route,
  .hedge-result-metrics {
    grid-column: 2;
  }

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

  .hedge-result-body {
    padding: 14px;
  }

  .hedge-order-grid,
  .hedge-scenario-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .hedge-heading {
    display: grid;
    gap: 4px;
  }

  .hedge-search {
    grid-template-columns: 1fr;
  }

  .hedge-route-field,
  .hedge-exchange-picker,
  .hedge-margin-field,
  .hedge-leverage-field,
  .hedge-submit {
    grid-column: 1;
    grid-row: auto;
  }

  .hedge-exchange-options {
    grid-template-columns: repeat(7, minmax(34px, 1fr));
  }

  .hedge-leg dl,
  .hedge-scenario dl {
    grid-template-columns: 1fr 1fr;
  }

  .hedge-leg dl > div,
  .hedge-scenario dl > div,
  .hedge-leg dl > div:nth-child(3n),
  .hedge-scenario dl > div:nth-child(3n) {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .hedge-leg dl > div:nth-child(2n),
  .hedge-scenario dl > div:nth-child(2n) {
    border-right: 0;
  }

  .hedge-leg dl > div:nth-last-child(-n + 2),
  .hedge-scenario dl > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

/* Listings stay a chronological table on narrow screens; the wrapper scrolls. */
@media (max-width: 1280px) {
  .listings-scroll {
    min-height: 360px;
    overflow-x: auto;
    padding: 0;
  }

  .listings-table {
    display: table;
    width: 100%;
    min-width: 1030px;
    table-layout: fixed;
  }

  .listings-table thead {
    display: table-header-group;
  }

  .listings-table tbody {
    display: table-row-group;
  }

  .listings-table tbody tr,
  .listings-table tbody tr:nth-child(even) {
    display: table-row;
    width: auto;
    border: 0;
  }

  .listings-table tbody td,
  .listings-table tbody td:nth-child(n) {
    position: static;
    display: table-cell;
    width: auto;
    height: 44px;
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid rgba(39, 52, 60, .78);
    padding: 0 10px;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .listings-table tbody td.number-cell {
    text-align: right;
  }

  .listings-table tbody td::before {
    display: none;
  }

  .listings-table tbody td.sticky-column {
    position: sticky;
  }

  .listings-table .empty-row {
    display: table-row !important;
  }

  .listings-table .empty-row td {
    display: table-cell !important;
    height: 180px !important;
    text-align: center;
  }
}

/* Trades workspace */
.trades-view {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-lg);
}

.trades-heading {
  display: flex;
  min-width: 0;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
  padding: 20px 22px;
}

.trades-heading h1,
.trades-heading p,
.trades-panel-heading h2,
.trades-panel-heading p {
  margin: 0;
}

.trades-heading h1 {
  font-size: clamp(26px, 2.3vw, 36px);
  font-weight: 730;
  letter-spacing: -.045em;
}

.trades-heading p,
.trades-panel-heading p {
  color: var(--muted);
  font-size: 11px;
}

.trades-heading-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-sm);
}

.trades-shell {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(210px, 250px) minmax(430px, 1fr) minmax(270px, 320px);
  align-items: start;
  gap: var(--space-lg);
}

.trades-shell.is-member {
  grid-template-columns: minmax(430px, 1fr) minmax(270px, 320px);
}

.trades-users,
.trades-chart-panel,
.trades-summary,
.trades-table-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.trades-users {
  position: sticky;
  top: calc(var(--header-height) + var(--space-lg));
  max-height: calc(100dvh - var(--header-height) - 54px);
}

.trades-users > header,
.trades-panel-heading {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.trades-users > header span,
.trades-panel-heading > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.trades-panel-heading h2 {
  font-size: 16px;
  letter-spacing: -.025em;
}

.trades-user-list {
  display: grid;
  gap: 4px;
  max-height: calc(100dvh - var(--header-height) - 124px);
  overflow-y: auto;
  padding: 8px;
}

.trades-user-item {
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  padding: 9px 10px;
  text-align: left;
  transition: background-color 140ms ease, border-color 140ms ease, transform 100ms ease;
}

.trades-user-item:hover {
  background: var(--surface-raised);
}

.trades-user-item:active {
  transform: scale(.985);
}

.trades-user-item.is-active {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.trades-user-item > span:first-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.trades-user-item strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trades-user-item small {
  color: var(--muted);
  font-size: 9px;
}

.trades-user-pin {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-raised);
  padding: 2px 5px;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .06em;
}

.trades-user-result {
  color: var(--success);
  font-family: var(--mono);
  font-size: 9px;
  white-space: nowrap;
}

.trades-user-result.is-negative,
.trades-primary-metric strong.is-negative,
.trades-table .is-negative,
.trades-legend-item .is-negative {
  color: var(--danger);
}

.trades-chart-panel {
  min-height: 454px;
}

.trades-chart-wrap {
  position: relative;
  display: grid;
  min-height: 276px;
  place-items: center;
  padding: 16px;
}

.trades-donut {
  width: min(100%, 252px);
  overflow: visible;
  transform: rotate(-90deg);
}

.donut-track,
.donut-segment {
  fill: none;
  stroke-width: 25;
}

.donut-track {
  stroke: var(--surface-active);
}

.donut-segment {
  cursor: pointer;
  transition: stroke-width 140ms ease, opacity 140ms ease;
}

.donut-segment:hover,
.donut-segment:focus-visible {
  stroke-width: 30;
  outline: 0;
}

.trades-chart-center {
  position: absolute;
  display: grid;
  place-items: center;
  gap: 2px;
  pointer-events: none;
}

.trades-chart-center span {
  color: var(--muted);
  font-size: 10px;
}

.trades-chart-center strong {
  font-family: var(--mono);
  font-size: 30px;
  letter-spacing: -.04em;
}

.trades-chart-tooltip {
  position: absolute;
  z-index: 2;
  display: grid;
  min-width: 150px;
  gap: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 12px 28px rgba(38, 45, 62, .16);
  padding: 9px 11px;
  pointer-events: none;
}

.trades-chart-tooltip strong {
  font-family: var(--mono);
  font-size: 12px;
}

.trades-chart-tooltip span,
.trades-chart-tooltip small {
  font-family: var(--mono);
  font-size: 10px;
}

.trades-chart-tooltip small {
  color: var(--muted);
}

.trades-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border-top: 1px solid var(--line);
  padding: 10px;
}

.trades-legend-item {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  padding: 5px 7px 5px 16px;
  text-align: left;
}

.trades-legend-item::before {
  position: absolute;
  left: 6px;
  width: 4px;
  height: 18px;
  border-radius: 3px;
  background: var(--legend-color);
  content: "";
}

.trades-legend-item:hover,
.trades-legend-item:focus-visible {
  background: var(--surface-raised);
}

.trades-legend-item strong {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trades-legend-item span {
  color: var(--success);
  font-family: var(--mono);
  font-size: 9px;
  white-space: nowrap;
}

.trades-summary {
  min-height: 454px;
}

.trades-primary-metric {
  display: grid;
  gap: 5px;
  border-bottom: 1px solid var(--line);
  padding: 22px 18px;
}

.trades-primary-metric > span,
.trades-primary-metric small {
  color: var(--muted);
  font-size: 10px;
}

.trades-primary-metric strong {
  color: var(--success);
  font-family: var(--mono);
  font-size: clamp(21px, 2vw, 28px);
  letter-spacing: -.04em;
}

.trades-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
}

.trades-metrics > div {
  display: grid;
  min-width: 0;
  min-height: 90px;
  align-content: center;
  gap: 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.trades-metrics > div:nth-child(2n) {
  border-right: 0;
}

.trades-metrics > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.trades-metrics dt {
  color: var(--muted);
  font-size: 9px;
}

.trades-metrics dd {
  overflow: hidden;
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trades-table-panel {
  grid-column: 2 / -1;
}

.trades-shell.is-member .trades-table-panel {
  grid-column: 1 / -1;
}

.trades-table-heading {
  min-height: 74px;
}

.trades-search-field {
  width: min(280px, 45%);
}

.trades-search-field input {
  width: 100%;
  min-height: 38px;
  padding-inline: 11px;
}

.trades-table-scroll {
  min-height: 280px;
  max-height: 520px;
  overflow: auto;
}

.trades-table {
  min-width: 980px;
  table-layout: fixed;
}

.trades-table th:nth-child(1), .trades-table td:nth-child(1) { width: 154px; }
.trades-table th:nth-child(2), .trades-table td:nth-child(2) { width: 150px; }
.trades-table th:nth-child(3), .trades-table td:nth-child(3) { width: 142px; }
.trades-table th:nth-child(4), .trades-table td:nth-child(4) { width: 130px; }
.trades-table th:nth-child(5), .trades-table td:nth-child(5) { width: 110px; }
.trades-table th:nth-child(6), .trades-table td:nth-child(6) { width: 110px; }
.trades-table th:nth-child(7), .trades-table td:nth-child(7) { width: 110px; }
.trades-table th:nth-child(8), .trades-table td:nth-child(8) { width: 120px; }

.trades-table td {
  font-family: var(--mono);
  font-size: 10px;
}

.trades-table .trade-symbol-cell {
  font-size: 11px;
  font-weight: 750;
}

.trades-table .is-positive {
  color: var(--success);
}

.trades-state {
  min-height: 72px;
}

.role-picker {
  display: grid;
  gap: 8px;
  margin: 0;
  border: 0;
  padding: 0;
}

.role-picker legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
}

.role-picker label {
  position: relative;
  display: grid;
  min-height: 62px;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
}

.role-picker label:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent);
}

.role-picker input {
  accent-color: var(--accent);
}

.role-picker label > span {
  display: grid;
  gap: 2px;
}

.role-picker small {
  color: var(--muted);
  font-size: 10px;
}

.generated-user {
  display: grid;
  place-items: center;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  padding: 18px;
  text-align: center;
}

.generated-user > span,
.generated-user > small {
  color: var(--muted);
  font-size: 10px;
}

.generated-user > strong {
  font-size: 20px;
}

.generated-pin {
  border: 0;
  border-radius: 9px;
  background: var(--text);
  padding: 8px 14px;
  color: var(--surface);
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 750;
  letter-spacing: .18em;
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 11px;
}

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

.trades-pin-field input {
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 750;
  letter-spacing: .34em;
  text-align: center;
}

.trades-pin-field input::placeholder {
  color: var(--muted);
  opacity: .5;
}

.trades-pin-note {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.account-picker {
  display: grid;
  gap: var(--space-2);
  max-height: min(55vh, 540px);
  overflow-y: auto;
  padding-right: 2px;
}

.account-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  min-height: 64px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  text-align: left;
}

.account-picker-item:hover,
.account-picker-item:focus-visible,
.account-picker-item.is-active {
  border-color: var(--accent-strong);
}

.account-picker-item span {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.account-picker-item strong,
.account-picker-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-picker-item small { color: var(--muted); }

.account-picker-item code {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: .12em;
}

.trade-dropzone {
  display: grid;
  min-height: 300px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-panel);
  background: var(--surface-raised);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, transform 100ms ease;
}

.trade-dropzone:hover,
.trade-dropzone.is-dragging,
.trade-dropzone.has-file {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.trade-dropzone.is-dragging {
  transform: scale(.99);
}

.trade-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.dropzone-mark {
  display: grid;
  width: 54px;
  height: 64px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(48, 56, 76, .08);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
}

.trade-dropzone small {
  color: var(--muted);
}

.dropzone-file {
  max-width: 100%;
  margin-top: 6px;
  overflow: hidden;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .trades-shell,
  .trades-shell.is-member {
    grid-template-columns: minmax(210px, 240px) minmax(0, 1fr);
  }

  .trades-shell.is-member {
    grid-template-columns: minmax(0, 1fr);
  }

  .trades-summary {
    grid-column: 2;
    min-height: 0;
  }

  .trades-shell.is-member .trades-summary {
    grid-column: 1;
  }

  .trades-table-panel,
  .trades-shell.is-member .trades-table-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .trades-view {
    gap: 10px;
  }

  .trades-heading {
    min-height: 78px;
    padding: 15px;
  }

  .trades-heading h1 {
    font-size: 25px;
  }

  .trades-shell,
  .trades-shell.is-member {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .trades-users,
  .trades-summary,
  .trades-shell.is-member .trades-summary,
  .trades-table-panel {
    position: static;
    grid-column: 1;
    max-height: none;
  }

  .trades-user-list {
    max-height: 260px;
  }

  .trades-chart-panel,
  .trades-summary {
    min-height: 0;
  }

  .trades-table-heading {
    align-items: stretch;
  }

  .trades-search-field {
    width: min(210px, 48%);
  }
}

@media (max-width: 520px) {
  .primary-nav .nav-tab {
    gap: 3px;
    padding-inline: 5px;
    font-size: 11px;
  }

  .trades-heading {
    align-items: stretch;
  }

  .trades-heading .button {
    align-self: center;
    padding-inline: 10px;
  }

  .trades-heading-actions {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .trades-heading-actions #trades-primary-action {
    grid-column: 1 / -1;
  }

  .trades-heading p {
    max-width: 23ch;
  }

  .trades-table-heading {
    display: grid;
  }

  .trades-search-field {
    width: 100%;
  }

  .trades-legend {
    grid-template-columns: 1fr;
  }

  .modal-header {
    align-items: flex-start;
  }

  .trade-dropzone {
    min-height: 240px;
    padding: 18px;
  }
}

/* Trade history remains a real table at every width; its own wrapper scrolls. */
.trades-table-scroll {
  overflow-x: auto;
  padding: 0;
}

.trades-table {
  display: table;
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
}

.trades-table thead {
  display: table-header-group;
}

.trades-table tbody {
  display: table-row-group;
}

.trades-table tbody tr,
.trades-table tbody tr:nth-child(even) {
  display: table-row;
  width: auto;
  border: 0;
}

.trades-table tbody td,
.trades-table tbody td:nth-child(n) {
  position: static;
  display: table-cell;
  width: auto;
  height: 44px;
  min-height: 0;
  border-right: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 10px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trades-table tbody td.number-cell {
  text-align: right;
}

.trades-table tbody td::before {
  display: none;
}
.team-manual-form {
  display: grid;
  grid-template-columns: minmax(130px, .8fr) minmax(190px, 1fr) minmax(150px, .8fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.team-manual-form[hidden] { display: none; }
.team-manual-form .form-error { grid-column: 1 / -1; margin: 0; }
@media (max-width: 800px) {
  .team-manual-form { grid-template-columns: 1fr; }
}

.team-crm {
  display: grid;
  gap: var(--space-4);
}

.team-crm-toolbar {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) auto minmax(190px, 240px);
  align-items: end;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.team-month-navigation {
  display: grid;
  grid-template-columns: 36px auto 36px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-2);
}

.team-month-navigation > div:last-child {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
  margin-left: var(--space-2);
}

.team-month-navigation h2,
.team-month-navigation p,
.team-pipeline h2,
.team-pipeline p {
  margin: 0;
}

.team-month-navigation h2 {
  font-size: 17px;
}

.team-month-navigation p {
  color: var(--muted);
  font-size: 12px;
  text-transform: capitalize;
}

.team-calendar-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(68px, 1fr));
  align-self: stretch;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.team-calendar-stats > div {
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 0 var(--space-3);
}

.team-calendar-stats strong {
  font: 700 19px/1 var(--mono);
  color: var(--text);
}

.team-calendar-stats span {
  color: var(--muted);
  font-size: 10px;
}

.team-user-filter {
  min-width: 0;
}

.team-crm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: var(--space-4);
}

.team-calendar-panel,
.team-pipeline,
.team-day-detail {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.team-calendar-weekdays,
.team-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.team-calendar-weekdays {
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.team-calendar-weekdays span {
  padding: 10px 12px;
  background: var(--surface-raised);
  color: var(--muted);
  font: 700 10px/1 var(--mono);
  text-transform: uppercase;
}

.team-calendar-grid {
  gap: 1px;
  background: var(--line);
}

.team-calendar-day {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--space-2);
  min-width: 0;
  min-height: 168px;
  padding: var(--space-2);
  border: 0;
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.team-calendar-day:hover,
.team-calendar-day:focus-visible {
  background: var(--surface-raised);
  box-shadow: inset 0 0 0 2px var(--accent);
  outline: 0;
}

.team-calendar-day:active {
  transform: translateY(1px);
}

.team-calendar-day.is-outside {
  background: color-mix(in srgb, var(--surface) 70%, var(--bg));
  color: var(--muted);
}

.team-calendar-day.is-today {
  box-shadow: inset 0 2px 0 var(--accent-strong);
}

.team-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.team-calendar-day time {
  font: 700 12px/1 var(--mono);
}

.team-day-header > span {
  color: var(--muted);
  font: 600 9px/1 var(--mono);
}

.team-day-activities {
  display: grid;
  align-content: start;
  gap: 6px;
}

.team-activity-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 8px;
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-active);
}

.team-card-primary,
.team-card-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.team-card-primary strong {
  overflow: hidden;
  font: 750 11px/1 var(--mono);
  text-overflow: ellipsis;
}

.team-card-primary span,
.team-card-meta,
.team-card-users {
  font-size: 8px;
  line-height: 1.25;
}

.team-card-primary span {
  flex: 0 0 auto;
  font-family: var(--mono);
}

.team-test-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  font: 700 9px/1 var(--mono);
}

.team-test-status.is-verified {
  border-color: color-mix(in srgb, #18a779 50%, var(--line));
  background: color-mix(in srgb, #18a779 12%, var(--surface));
  color: #0f8d66;
}

.team-test-status.is-mixed {
  border-color: color-mix(in srgb, #c88a19 50%, var(--line));
  background: color-mix(in srgb, #c88a19 12%, var(--surface));
  color: #a66d09;
}

.team-test-status.is-untested {
  color: var(--muted);
}

.team-card-meta,
.team-card-users {
  color: var(--muted);
}

.team-card-users {
  overflow: hidden;
  color: var(--text-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-calendar-state {
  padding: var(--space-4);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.team-pipeline {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  overflow: hidden;
}

.team-pipeline > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.team-pipeline h2 {
  font-size: 16px;
}

.team-pipeline header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.team-pipeline > header > strong {
  color: var(--accent-strong);
  font: 700 20px/1 var(--mono);
}

.team-pipeline-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: var(--space-2);
  min-height: 0;
}

.team-pipeline-card {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.team-pipeline-rank {
  color: var(--muted);
  font: 700 10px/1.4 var(--mono);
}

.team-pipeline-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.team-pipeline-main > div {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.team-pipeline-main strong {
  font: 750 13px/1 var(--mono);
}

.team-pipeline-main span,
.team-pipeline-main small {
  color: var(--muted);
  font-size: 9px;
}

.team-pipeline-main p {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-pipeline-availability {
  display: grid;
  justify-items: end;
  align-content: center;
  gap: 5px;
  min-width: 112px;
}

.team-pipeline-availability strong {
  color: var(--accent-strong);
  font: 700 12px/1 var(--mono);
}

.team-pipeline-availability span {
  color: var(--muted);
  font: 600 8px/1 var(--mono);
}

.team-pipeline-availability.is-blocked strong,
.team-pipeline-availability.is-blocked span {
  color: #bd4b4b;
}

.team-day-detail {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
}

.team-day-detail[hidden] {
  display: none;
}

.team-day-detail > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.team-day-detail h2,
.team-day-detail p {
  margin: 0;
}

.team-day-detail h2 {
  font-size: 18px;
  text-transform: capitalize;
}

.team-day-detail p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.team-day-table-scroll {
  max-height: 620px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.team-day-table {
  width: 100%;
  min-width: 660px;
  border-collapse: collapse;
}

.team-day-table th,
.team-day-table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.team-day-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-raised);
  color: var(--muted);
  font: 700 9px/1 var(--mono);
  text-transform: uppercase;
}

.team-day-table tbody th {
  width: 86px;
  color: var(--text-soft);
  font: 700 11px/1.4 var(--mono);
}

.team-day-table td:last-child {
  width: 90px;
  color: var(--muted);
  font-family: var(--mono);
}

.team-day-table tr.has-events {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.team-hour-event {
  display: grid;
  gap: 4px;
  padding: 8px 0;
}

.team-hour-event + .team-hour-event {
  border-top: 1px solid var(--line);
}

.team-hour-event > div {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.team-hour-event strong {
  font: 750 12px/1 var(--mono);
}

.team-hour-event > span,
.team-hour-event small,
.team-hour-empty {
  color: var(--muted);
  font-size: 10px;
}

.team-pipeline-empty {
  padding: var(--space-5);
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

@media (max-width: 1180px) {
  .team-crm-toolbar {
    grid-template-columns: minmax(340px, 1fr) auto;
  }
  .team-user-filter {
    grid-column: 1 / -1;
  }
  .team-pipeline-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .team-crm-toolbar {
    grid-template-columns: 1fr;
  }
  .team-month-navigation {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
  }
  .team-month-navigation .icon-button,
  .team-month-navigation .button {
    width: 100%;
  }
  .team-month-navigation > div:last-child {
    grid-column: 1 / -1;
    order: -1;
    margin-left: 0;
  }
  .team-calendar-stats {
    border: 1px solid var(--line);
  }
  .team-calendar-panel {
    overflow-x: auto;
  }
  .team-calendar-weekdays,
  .team-calendar-grid {
    min-width: 980px;
  }
  .team-calendar-day {
    display: grid;
    min-height: 150px;
  }
  .team-pipeline-list {
    grid-template-columns: 1fr;
  }
  .team-activity-card {
    padding: var(--space-3);
  }
  .team-card-primary strong,
  .team-card-primary span {
    font-size: 12px;
  }
  .team-card-meta,
  .team-card-users {
    font-size: 10px;
  }
}

.mm-exchange-section,
.mm-coins-section {
  border: 1px solid var(--line);
  background: var(--surface);
}

.mm-exchange-section > header,
.mm-coins-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 58px;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}

.mm-exchange-section h2,
.mm-coins-section h2 {
  margin: 0;
  font-size: 14px;
}

.mm-exchange-section p,
.mm-coins-section p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.mm-exchanges {
  display: grid;
  grid-template-columns: repeat(5, minmax(118px, 1fr));
  gap: var(--space-2);
  padding: var(--space-3);
  overflow-x: auto;
}

.mm-exchange-card {
  display: flex;
  min-width: 118px;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 9px 10px;
  text-align: left;
}

.mm-exchange-card:hover { border-color: var(--line-strong); background: var(--surface-raised); }
.mm-exchange-card.is-connected { border-color: var(--accent); }
.mm-exchange-card img { flex: 0 0 auto; object-fit: contain; }
.mm-exchange-card span { display: grid; min-width: 0; gap: 2px; }
.mm-exchange-card strong { font-size: 12px; }
.mm-exchange-card small { overflow: hidden; color: var(--muted); font: 10px/1.2 var(--mono); text-overflow: ellipsis; white-space: nowrap; }

.mm-coins-toolbar {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(240px, 360px) auto;
}

.mm-search-field { margin: 0; }
.mm-coin-count { color: var(--muted); font: 12px/1 var(--mono); }
.mm-coins-section .mm-alert { margin: var(--space-3); }
.mm-coins-table { min-width: 860px; }
.mm-coins-table td:first-child strong { font: 700 13px/1 var(--mono); }
.mm-inline-select,
.mm-inline-limit {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0 9px;
  font: 12px/1 var(--mono);
}
.mm-inline-select { min-width: 126px; }
.mm-inline-limit { width: 136px; }
.mm-row-state { display: inline-block; max-width: 180px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.mm-row-state.is-running { color: var(--accent-strong); font-weight: 700; }
.mm-row-actions .button { min-width: 72px; }
.mm-active-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr)) auto;
  gap: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}
.mm-active-strip > div { display: grid; gap: 3px; padding: var(--space-3); border-right: 1px solid var(--line); }
.mm-active-strip span { color: var(--muted); font-size: 10px; }
.mm-active-strip strong { font-family: var(--mono); }
.mm-active-strip .button { align-self: center; margin: 0 var(--space-3); }

@media (max-width: 900px) {
  .mm-coins-toolbar { grid-template-columns: 1fr auto; }
  .mm-search-field { grid-column: 1 / -1; grid-row: 2; }
  .mm-active-strip { grid-template-columns: 1fr 1fr; }
  .mm-active-strip .button { grid-column: 1 / -1; margin-block: var(--space-3); }
}

@media (max-width: 600px) {
  .mm-exchange-section > header { align-items: flex-start; }
  .mm-exchanges { grid-template-columns: repeat(5, 128px); }
  .mm-coins-toolbar { grid-template-columns: 1fr; }
  .mm-search-field, .mm-coin-count { grid-column: auto; grid-row: auto; }
  .mm-active-strip { grid-template-columns: 1fr; }
  .mm-active-strip > div { border-right: 0; border-bottom: 1px solid var(--line); }
}
/* Ourbit scanner uses the same visual system as the LBank screen. */
.ourbit-logo {
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 14px;
  background: #526ee8;
  color: #fff;
  font-family: var(--sans);
  font-weight: 800;
  line-height: 1;
}
.ourbit-logo.brand-logo { width: 42px; height: 42px; font-size: 28px; }
.ourbit-logo.login-logo { width: 128px; height: 128px; margin: 0 auto 24px; font-size: 88px; }
.ourbit-table { min-width: 930px; }
.ourbit-table th:nth-child(n), .ourbit-table td:nth-child(n) { width: auto; }
.filter-essentials { grid-template-columns: minmax(170px, 1fr) auto minmax(190px, 210px) minmax(140px, 175px) auto; }
.filter-essentials > .field { min-width: 0; }
.filter-essentials .liquid-field { min-width: 190px; }
.filter-essentials .liquid-field small { white-space: normal; }
.exchange-logo-options { flex-wrap: wrap; }
.exchange-logo-option img { object-fit: contain; }
.detail-summary { margin-bottom: 14px; }
.detail-note + .detail-section-title { margin-top: 20px; }
.quote-table { width: 100%; }
.listings-table { min-width: 750px; }
@media (max-width: 1280px) {
  .filter-essentials { grid-template-columns: minmax(170px, 1fr) auto minmax(190px, 210px); }
  .filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 760px) {
  .filter-essentials { grid-template-columns: 1fr 1fr; }
  .exchange-picker, .search-field, .filter-actions, .filter-essentials .liquid-field, .filter-essentials > .field:has(#filter-status) { grid-column: 1 / -1; }
  .filter-essentials .liquid-field { min-width: 0; }
  .filter-actions { display: flex; }
  .opportunity-table.ourbit-table { min-width: 0; }
  .ourbit-table tbody td:nth-child(5) { grid-column: auto; }
  .ourbit-table tbody td:nth-last-child(2) { border-bottom: 0; }
}
