: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;
}

* {
  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;
}

.context-line {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.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: "/";
}

.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 {
    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;
  }
}

@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;
  }
}
