:root {
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --text: #171a1f;
  --muted: #68707c;
  --subtle: #929aa5;
  --border: #e3e6ea;
  --border-strong: #cfd4da;
  --brand: #f0b90b;
  --brand-dark: #9a6f00;
  --brand-soft: #fff8db;
  --green: #087f5b;
  --green-soft: #e9f7f1;
  --red: #c13b3a;
  --red-soft: #fff0ef;
  --blue: #2563a8;
  --blue-soft: #edf5ff;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.05);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
select,
input {
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(240, 185, 11, 0.3);
  outline-offset: 1px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  display: flex;
  width: min(1440px, 100%);
  min-height: 64px;
  margin: 0 auto;
  padding: 0 28px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid #d39b00;
  border-radius: 5px;
  background: var(--brand);
  color: #1a1a16;
  font-size: 17px;
  font-weight: 800;
}

.brand-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.brand-copy strong {
  overflow: hidden;
  font-size: 15px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand-copy span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

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

.portfolio-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.portfolio-picker select {
  width: 178px;
  height: 36px;
  min-width: 0;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  padding: 0 30px 0 10px;
}

.icon-button,
.command-button {
  display: inline-flex;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
}

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

.command-button {
  min-width: 82px;
  gap: 7px;
  padding: 0 13px;
  background: #1c2025;
  color: #fff;
  border-color: #1c2025;
  font-weight: 600;
}

.icon-button:hover:not(:disabled),
.command-button:hover:not(:disabled) {
  border-color: var(--brand-dark);
}

.command-button:hover:not(:disabled) {
  background: #30353b;
}

.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.spinning .icon {
  animation: spin 0.8s linear infinite;
}

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

.workspace {
  width: min(1440px, 100%);
  min-height: calc(100vh - 124px);
  margin: 0 auto;
  padding: 30px 28px 56px;
}

.profile-header {
  display: flex;
  min-height: 132px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding: 7px 0 25px;
}

.profile-main {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 17px;
}

.avatar-shell {
  display: grid;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #22262b;
  color: var(--brand);
  font-size: 24px;
  font-weight: 800;
}

.avatar-shell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-copy {
  min-width: 0;
}

.eyebrow-line {
  display: flex;
  min-height: 19px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot,
.source-pulse {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--subtle);
}

.status-dot.active,
.source-pulse {
  background: var(--green);
}

.divider-dot {
  color: var(--border-strong);
}

.profile-copy h1 {
  margin: 4px 0 3px;
  font-size: 27px;
  line-height: 1.25;
}

.portfolio-id {
  margin: 0;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.description {
  max-width: 760px;
  margin: 12px 0 0;
  color: #4d5560;
  line-height: 1.6;
  white-space: pre-line;
}

.profile-meta {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.source-state {
  display: inline-flex;
  height: 28px;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid #b8dacc;
  border-radius: 4px;
  background: var(--green-soft);
  color: #176448;
}

.message-banner,
.warning-item {
  display: flex;
  min-height: 40px;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid;
  border-radius: 5px;
  padding: 10px 12px;
  line-height: 1.45;
}

.error-banner {
  margin-bottom: 12px;
  border-color: #efb8b5;
  background: var(--red-soft);
  color: #8f2928;
}

.warning-list {
  display: grid;
  gap: 8px;
}

.warning-item {
  border-color: #ead48b;
  background: var(--brand-soft);
  color: #6f5400;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.metric-card {
  min-width: 0;
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
}

.metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.metric-value {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 11px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  line-height: 1.2;
}

.metric-sub {
  display: block;
  margin-top: 4px;
  color: var(--subtle);
  font-size: 10px;
}

.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.neutral { color: var(--muted) !important; }

.loading-block {
  position: relative;
  overflow: hidden;
  background: #eceff2;
}

.loading-block::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.view-toolbar {
  display: flex;
  min-height: 58px;
  margin-top: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-strong);
}

.tabs {
  display: flex;
  min-width: 0;
  align-self: stretch;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab-button {
  position: relative;
  display: inline-flex;
  min-width: max-content;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 17px;
  font-weight: 600;
}

.tab-button:first-child {
  padding-left: 2px;
  padding-right: 19px;
}

.tab-button::after {
  position: absolute;
  right: 15px;
  bottom: -1px;
  left: 15px;
  height: 2px;
  background: transparent;
  content: "";
}

.tab-button:first-child::after {
  left: 0;
}

.tab-button.active {
  color: var(--text);
}

.tab-button.active::after {
  background: var(--brand);
}

.tab-count {
  display: inline-grid;
  min-width: 22px;
  height: 20px;
  place-items: center;
  border-radius: 10px;
  background: #e8eaed;
  color: #5b626c;
  padding: 0 6px;
  font-size: 10px;
}

.segmented {
  display: inline-flex;
  flex: 0 0 auto;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  padding: 2px;
}

.segmented button {
  min-width: 47px;
  height: 30px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  padding: 0 9px;
  font-size: 12px;
}

.segmented button.active {
  background: #292d32;
  color: #fff;
}

.segmented.compact button {
  min-width: 52px;
  height: 27px;
}

.tab-panel {
  padding-top: 25px;
}

.tab-panel[hidden] {
  display: none;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.85fr);
  gap: 20px;
}

.data-section {
  min-width: 0;
  border-top: 2px solid #24282e;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
}

.section-heading {
  display: flex;
  min-height: 42px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-kicker {
  margin: 0 0 4px;
  color: var(--brand-dark);
  font-size: 9px;
  font-weight: 800;
}

.section-heading h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.section-asof,
.record-total {
  color: var(--muted);
  font-size: 12px;
}

.section-actions {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
}

.chart-summary {
  display: flex;
  min-height: 42px;
  margin-top: 8px;
  align-items: baseline;
  gap: 10px;
}

.chart-summary strong {
  font-size: 27px;
  font-variant-numeric: tabular-nums;
}

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

.chart-shell {
  width: 100%;
  height: 280px;
  margin-top: 5px;
  overflow: hidden;
}

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

.chart-grid-line {
  stroke: #e6e8eb;
  stroke-width: 1;
}

.chart-zero-line {
  stroke: #aeb5bd;
  stroke-dasharray: 4 4;
  stroke-width: 1;
}

.chart-label {
  fill: #7d858f;
  font-size: 10px;
}

.chart-area {
  fill: rgba(240, 185, 11, 0.12);
}

.chart-line {
  fill: none;
  stroke: #20242a;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.chart-point {
  fill: var(--brand);
  stroke: #1f2328;
  stroke-width: 1.5;
}

.chart-hit {
  fill: transparent;
}

.chart-empty,
.empty-cell {
  color: var(--subtle);
  text-align: center;
}

.chart-empty {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 1px dashed var(--border-strong);
}

.method-badge {
  min-width: max-content;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 5px 7px;
  font-size: 10px;
}

.latest-inference {
  min-height: 102px;
  margin-top: 12px;
  border-left: 4px solid var(--brand);
  background: var(--brand-soft);
  padding: 15px 16px;
}

.latest-inference.rotation {
  border-left-color: var(--blue);
  background: var(--blue-soft);
}

.inference-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.inference-title-line strong {
  font-size: 15px;
}

.confidence {
  color: var(--muted);
  font-size: 10px;
}

.latest-inference p {
  margin: 10px 0 0;
  color: #4d5560;
  line-height: 1.55;
}

.analysis-section {
  margin-top: 20px;
}

.behavior-summary {
  min-height: 80px;
  margin-top: 14px;
  border-left: 4px solid var(--brand);
  background: var(--brand-soft);
  padding: 15px 16px;
}

.behavior-summary strong {
  max-width: 900px;
  font-size: 14px;
  line-height: 1.55;
}

.behavior-summary > span {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: 10px;
}

.confidence {
  min-width: max-content;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface);
  padding: 3px 6px;
}

.confidence-high {
  border-color: #9dd9c8;
  color: var(--green);
}

.confidence-low {
  color: var(--subtle);
}

.evidence-grid,
.tracked-parameter-grid,
.scan-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  margin-top: 14px;
  border: 1px solid var(--border);
  background: var(--border);
}

.evidence-item,
.tracked-parameter,
.scan-summary-grid > div {
  min-width: 0;
  background: var(--surface);
  padding: 12px;
}

.evidence-item span,
.tracked-parameter span,
.scan-summary-grid span,
.estimate-summary span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.evidence-item strong,
.tracked-parameter strong,
.scan-summary-grid strong,
.estimate-summary strong {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 8px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.tracked-parameter small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
}

.hypothesis-list {
  margin-top: 14px;
  border-top: 1px solid var(--border);
}

.hypothesis-row {
  border-bottom: 1px solid var(--border);
  padding: 14px 2px;
}

.hypothesis-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hypothesis-heading strong {
  font-size: 13px;
}

.hypothesis-row p {
  margin: 7px 0 4px;
  color: #353b43;
  font-size: 12px;
  line-height: 1.55;
}

.hypothesis-row > span,
.ai-facts span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.ai-facts {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 14px;
  border-bottom: 1px solid var(--border);
  background: var(--blue-soft);
  padding: 13px 12px;
}

.subsection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}

.subsection-heading h3 {
  margin: 0;
  font-size: 13px;
}

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

.estimate-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin-top: 16px;
  border-bottom: 1px solid var(--border);
  padding: 0 0 16px;
}

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

.preference-progress {
  width: 180px;
  height: 8px;
  overflow: hidden;
  border: 0;
  border-radius: 2px;
  background: #e8eaed;
  color: var(--brand-dark);
}

.preference-progress::-webkit-progress-bar {
  background: #e8eaed;
}

.preference-progress::-webkit-progress-value {
  background: var(--brand);
}

.preference-progress::-moz-progress-bar {
  background: var(--brand);
}

.raw-key {
  display: block;
  margin-top: 2px;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 9px;
}

.row-tag {
  display: block;
  margin-top: 3px;
  color: var(--subtle);
  font-size: 9px;
}

.latency-label {
  font-size: 10px;
}

.latency-label.backfill {
  color: var(--subtle);
}

.latency-label.live {
  color: var(--green);
  font-weight: 700;
}

.scan-label {
  font-size: 10px;
  font-weight: 700;
}

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

.scan-partial {
  color: #9a6700;
}

.scan-failed {
  color: var(--red);
}

.empty-inline {
  color: var(--subtle);
  font-size: 12px;
}

.event-list {
  display: grid;
  margin-top: 10px;
}

.event-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 12px 2px;
}

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

.event-time {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.event-detail strong {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
}

.event-detail span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.market-section,
.visibility-section {
  margin-top: 20px;
}

.table-scroll {
  width: 100%;
  margin-top: 13px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 11px 12px;
  text-align: left;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 0;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 0;
}

.data-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.data-table td {
  color: #373d45;
  font-size: 12px;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover td {
  background: #fafbfc;
}

.data-table .numeric {
  text-align: right;
}

.data-table.dense th,
.data-table.dense td {
  padding-top: 9px;
  padding-bottom: 9px;
}

#trade-table {
  min-width: 1320px;
}

#transfer-table {
  min-width: 1220px;
}

#funding-pattern-table,
#parameter-change-table,
#scan-history-table {
  min-width: 920px;
}

.side-label {
  display: inline-flex;
  min-width: 42px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
}

.side-label.buy {
  background: var(--green-soft);
  color: var(--green);
}

.side-label.sell {
  background: var(--red-soft);
  color: var(--red);
}

.availability-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 1px;
  margin-top: 13px;
  border: 1px solid var(--border);
  background: var(--border);
}

.availability-item {
  min-height: 78px;
  background: var(--surface);
  padding: 12px;
}

.availability-name {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.availability-name::before {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--green);
  content: "";
}

.availability-item.failed .availability-name::before {
  background: var(--red);
}

.availability-value {
  display: block;
  margin-top: 10px;
  font-size: 16px;
  font-weight: 700;
}

.availability-note {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--subtle);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.full-table-section {
  min-height: 560px;
}

.parameter-toolbar {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.parameter-toolbar > span {
  color: var(--muted);
  font-size: 12px;
}

.search-field {
  position: relative;
  display: flex;
  width: min(420px, 100%);
  align-items: center;
}

.search-field > span {
  position: absolute;
  left: 11px;
  display: grid;
  color: var(--muted);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px 0 36px;
}

.parameter-sections {
  display: grid;
  gap: 18px;
}

.parameter-section {
  border-top: 2px solid #24282e;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.parameter-heading {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
}

.parameter-heading h2 {
  margin: 0;
  font-size: 14px;
}

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

.field-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.field-table col:nth-child(1) { width: 24%; }
.field-table col:nth-child(2) { width: 28%; }
.field-table col:nth-child(3) { width: 48%; }

.field-table th,
.field-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 18px;
  text-align: left;
  vertical-align: top;
}

.field-table tr:last-child td {
  border-bottom: 0;
}

.field-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.field-label {
  color: #343a42;
  font-size: 12px;
}

.field-key {
  overflow-wrap: anywhere;
  color: var(--blue);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.field-value {
  overflow-wrap: anywhere;
  color: #343a42;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.null-value {
  color: var(--subtle);
  font-style: italic;
}

.footer {
  display: flex;
  width: min(1440px, 100%);
  min-height: 60px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  padding: 0 28px;
  font-size: 11px;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }

  .availability-grid {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .evidence-grid,
  .tracked-parameter-grid,
  .scan-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .estimate-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar-inner,
  .workspace,
  .footer {
    padding-right: 18px;
    padding-left: 18px;
  }

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

  .profile-header {
    flex-direction: column;
    gap: 14px;
  }

  .profile-meta {
    margin-left: 81px;
  }
}

@media (max-width: 680px) {
  .topbar {
    position: static;
  }

  .topbar-inner {
    min-height: 118px;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .topbar-actions {
    width: 100%;
  }

  .portfolio-picker {
    min-width: 0;
    flex: 1;
  }

  .portfolio-picker > span {
    display: none;
  }

  .portfolio-picker select {
    width: 100%;
  }

  .workspace {
    padding-top: 21px;
    padding-bottom: 38px;
  }

  .profile-header {
    min-height: 0;
  }

  .avatar-shell {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .profile-copy h1 {
    font-size: 22px;
  }

  .description {
    font-size: 12px;
  }

  .profile-meta {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

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

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

  .metric-value {
    font-size: 16px;
  }

  .view-toolbar {
    align-items: stretch;
    flex-direction: column;
    border-bottom: 0;
    padding-bottom: 13px;
  }

  .tabs {
    display: grid;
    width: 100%;
    min-height: 48px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-bottom: 1px solid var(--border-strong);
    overflow: visible;
  }

  .tab-button {
    min-width: 0;
    justify-content: center;
    padding-right: 4px;
    padding-left: 4px;
    font-size: 11px;
  }

  .tab-button:first-child {
    padding-right: 4px;
    padding-left: 4px;
  }

  .tab-button::after {
    right: 4px;
    left: 4px;
  }

  .tab-button:first-child::after {
    left: 4px;
  }

  .tab-count {
    display: none;
  }

  #range-control {
    width: 100%;
  }

  #range-control button {
    flex: 1;
  }

  .tab-panel {
    padding-top: 12px;
  }

  .data-section {
    padding: 16px 14px;
  }

  .chart-shell {
    height: 240px;
  }

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

  .evidence-grid,
  .tracked-parameter-grid,
  .scan-summary-grid,
  .estimate-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-heading {
    flex-wrap: wrap;
  }

  .section-actions {
    width: 100%;
    align-items: stretch;
  }

  #trade-view-control {
    width: 100%;
  }

  #trade-view-control button {
    flex: 1;
  }

  .ai-facts {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .parameter-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .field-table {
    table-layout: auto;
  }

  .field-table col:nth-child(1),
  .field-table col:nth-child(2),
  .field-table col:nth-child(3) {
    width: auto;
  }

  .field-table th,
  .field-table td {
    padding-right: 12px;
    padding-left: 12px;
  }

  .field-table th:first-child,
  .field-table td:first-child {
    min-width: 120px;
  }

  .field-table th:nth-child(2),
  .field-table td:nth-child(2) {
    min-width: 155px;
  }

  .field-table th:nth-child(3),
  .field-table td:nth-child(3) {
    min-width: 220px;
  }

  .parameter-section {
    overflow-x: auto;
  }

  .footer {
    min-height: 80px;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    padding-top: 16px;
    padding-bottom: 16px;
  }
}

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