:root {
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-strong: rgba(255, 255, 255, 1);
  --ink: #121826;
  --muted: #667085;
  --line: rgba(18, 24, 38, 0.08);
  --accent: #1d4ed8;
  --accent-soft: rgba(29, 78, 216, 0.1);
  --teal: #0f766e;
  --teal-soft: rgba(15, 118, 110, 0.1);
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, #f8fafc 0%, #f4f6fb 100%);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input,
select {
  font: inherit;
}

.shell {
  max-width: min(1680px, calc(100vw - 20px));
  margin: 0 auto;
  padding: 12px 10px 24px;
}

.app-shell {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.main-shell {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.panel,
.card,
.record,
.feature-card,
.subpanel,
.empty-state,
.loading-state {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 10px;
  display: grid;
  gap: 10px;
  padding: 12px 10px;
  align-content: start;
}

.sidebar-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(29, 78, 216, 0.24);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.08;
}

.lede,
.section-lede {
  max-width: 880px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.shell-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
}

.shell-topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.shell-topbar-copy {
  min-width: 0;
}

.shell-topbar-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.shell-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 220px;
}

.summary-strip {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  align-items: stretch;
}

.summary-strip .card {
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.shell-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.shell-pill-success {
  border-color: rgba(15, 118, 110, 0.18);
  background: rgba(15, 118, 110, 0.08);
  color: var(--teal);
}

.shell-pill-warn {
  border-color: rgba(217, 119, 6, 0.18);
  background: rgba(217, 119, 6, 0.08);
  color: #b45309;
}

.shell-pill-plain,
.shell-pill-muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  padding: 16px;
  min-width: 0;
}

.card-title {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  min-height: 17px;
}

.card-value {
  margin: 12px 0 8px;
  max-width: 100%;
  min-height: 36px;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1.16;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-wrap: balance;
}

.card-value-positive {
  color: var(--teal);
}

.card-value-negative {
  color: #b42318;
}

.card-value-code {
  font-family: "SFMono-Regular", "IBM Plex Mono", "Menlo", monospace;
  font-size: clamp(16px, 1.55vw, 22px);
  line-height: 1.24;
  letter-spacing: 0.01em;
  text-wrap: pretty;
}

.card-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  min-height: 42px;
}

.module-nav {
  display: grid;
  gap: 8px;
}

.sidebar-section {
  display: grid;
  gap: 5px;
}

.sidebar-section-title {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-section-collapsible {
  border: 1px solid rgba(18, 24, 38, 0.06);
  border-radius: 14px;
  background: rgba(246, 248, 252, 0.92);
  padding: 7px 7px 5px;
}

.sidebar-section-collapsible summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
  font-size: 13px;
}

.sidebar-section-copy {
  display: none;
}

.sidebar-section-links {
  display: grid;
  gap: 6px;
  margin-top: 2px;
}

.sidebar-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  padding: 11px 12px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 13px;
  line-height: 1.1;
  text-align: left;
}

.sidebar-item strong {
  color: var(--accent);
  font-size: 0.95em;
}

.sidebar-item.is-active {
  background: rgba(29, 78, 216, 0.12);
  border-color: rgba(29, 78, 216, 0.22);
  color: var(--accent);
}

.sidebar-item.is-active strong {
  color: var(--accent);
}

.workspace,
.endpoints-panel {
  margin-top: 0;
  padding: 14px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-head h2,
.panel-head h3,
.section-title {
  margin: 0;
}

.inline-count {
  color: var(--accent);
  font-size: 0.78em;
}

.toolbar {
  margin-top: 10px;
}

.toolbar-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.close-trade-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-top: 18px;
}

.toolbar-note {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 160px;
}

.field.grow {
  flex: 1 1 280px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field input,
.field select,
.button {
  border-radius: 12px;
  border: 1px solid var(--line);
  min-height: 40px;
}

.field input,
.field select {
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.88);
}

.button {
  padding: 0 14px;
  background: var(--accent);
  color: #eff6ff;
  cursor: pointer;
}

.button.ghost {
  background: #fff;
  color: var(--ink);
}

.download-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.orders-history-scope-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.orders-history-scope-toggle .button {
  display: inline-flex;
  align-items: center;
  min-width: 108px;
  min-height: 52px;
  justify-content: center;
  text-align: center;
  padding: 0 22px;
  line-height: 1;
  font-weight: 600;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
}

.orders-history-scope-toggle .button.is-active,
.orders-history-scope-toggle .button.is-active:disabled {
  background: rgba(29, 78, 216, 0.12);
  border-color: rgba(29, 78, 216, 0.22);
  color: var(--accent);
  opacity: 1;
  cursor: default;
}

.orders-history-scope-toggle .button.is-current:hover {
  text-decoration: none;
}

.orders-phase-stats {
  margin: 14px 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(248, 250, 252, 0.72);
}

.compact-head {
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.compact-head h4 {
  margin: 0 0 4px;
  font-size: 15px;
}

.compact-head p {
  margin: 0;
}

.phase-stats-summary {
  margin-left: auto;
  text-align: right;
  color: var(--muted);
}

.phase-stats-summary strong {
  display: block;
  color: var(--ink);
  font-size: 20px;
}

.phase-stats-summary span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.phase-stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 0;
}

.phase-stat-card .badge {
  width: fit-content;
}

.phase-stat-card small {
  line-height: 1.5;
}

.module-content {
  margin-top: 12px;
}

.section-grid,
.feature-grid,
.record-list {
  display: grid;
  gap: 16px;
}

.section-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.feature-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.compact-record-list {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.chart-shell {
  display: grid;
  gap: 14px;
}

.ladder-workbench-grid {
  align-items: start;
}

.ladder-note {
  display: none;
}

.system-decision-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.system-decision-grid > :first-child {
  grid-column: 1 / -1;
}

.system-primary-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  margin-bottom: 16px;
}

.execution-money-board {
  margin-bottom: 16px;
}

.execution-money-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.execution-money-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.execution-money-card {
  min-height: 108px;
  justify-content: flex-start;
}

.execution-money-card strong {
  margin-top: 10px;
  font-size: clamp(18px, 1.7vw, 26px);
  line-height: 1.14;
  overflow-wrap: anywhere;
}

.execution-money-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.4;
  font-size: 12px;
}

.execution-overview-panel {
  margin-bottom: 16px;
}

.execution-overview-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.execution-overview-grid .metric {
  min-height: 104px;
}

.execution-overview-grid .metric strong.card-value-positive,
.card-value-positive {
  color: var(--teal);
}

.execution-overview-grid .metric strong.card-value-negative,
.card-value-negative {
  color: #b42318;
}

.execution-overview-grid .metric em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-style: normal;
  line-height: 1.4;
  font-size: 12px;
}

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

.system-console-main,
.system-console-side {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.system-console-side {
  align-content: start;
}

.ladder-compare-details .details-body {
  padding-top: 14px;
}

.ladder-summary-grid,
.ladder-dual-grid {
  display: grid;
  gap: 14px;
}

.quick-start-grid {
  margin-top: 18px;
}

.quick-start-copy {
  margin-top: 16px;
}

.metric-emphasis strong {
  color: var(--accent);
}

.system-focus-card {
  display: grid;
  gap: 14px;
}

.system-topline-grid,
.overview-main-grid {
  margin-bottom: 12px;
}

.system-instruction-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(18, 24, 38, 0.08);
  background: rgba(248, 250, 252, 0.92);
}

.system-instruction-strip strong {
  font-size: 13px;
}

.system-instruction-strip span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.system-focus-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.28;
}

.system-focus-aligned {
  border-color: rgba(31, 117, 142, 0.18);
}

.system-focus-watch,
.system-focus-flat {
  border-color: rgba(95, 108, 123, 0.14);
}

.system-focus-misaligned {
  border-color: rgba(173, 63, 35, 0.2);
}

.status-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.status-list li {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(30, 36, 48, 0.08);
  color: var(--muted);
  line-height: 1.6;
}

.system-details-panel {
  margin-top: 18px;
}

.overview-details,
.guide-details {
  margin-top: 18px;
}

.ledger-detail-panel {
  margin-top: 8px;
}

.ledger-detail-panel summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}

.ledger-detail-panel .details-body {
  padding: 10px 0 0;
}

.details-body {
  display: grid;
  gap: 14px;
  padding: 0 14px 14px;
}

.ladder-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  margin-top: 16px;
}

.ladder-summary-grid-secondary {
  margin-top: 0;
}

.ladder-dual-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-top: 18px;
}

.ladder-guidance {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(30, 36, 48, 0.08);
  color: var(--muted);
}

.ladder-guidance p {
  margin-bottom: 6px;
}

.ladder-guidance p:last-child {
  margin-bottom: 0;
}

.ladder-guidance-aligned {
  border-color: rgba(31, 117, 142, 0.18);
  background: rgba(31, 117, 142, 0.08);
}

.ladder-guidance-watch,
.ladder-guidance-flat {
  border-color: rgba(95, 108, 123, 0.16);
  background: rgba(95, 108, 123, 0.08);
}

.ladder-guidance-misaligned {
  border-color: rgba(173, 63, 35, 0.22);
  background: rgba(173, 63, 35, 0.08);
}

.ladder-compare-stack {
  display: grid;
  gap: 14px;
}

.ladder-decision-card {
  display: grid;
  gap: 14px;
  margin: 18px 0;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(30, 36, 48, 0.08);
  background: rgba(255, 255, 255, 0.82);
}

.ladder-decision-card-aligned {
  border-color: rgba(31, 117, 142, 0.2);
  background: rgba(31, 117, 142, 0.08);
}

.ladder-decision-card-watch,
.ladder-decision-card-flat {
  border-color: rgba(95, 108, 123, 0.16);
  background: rgba(95, 108, 123, 0.08);
}

.ladder-decision-card-misaligned {
  border-color: rgba(173, 63, 35, 0.22);
  background: rgba(173, 63, 35, 0.09);
}

.ladder-decision-copy p,
.ladder-decision-notes p {
  margin: 0;
}

.ladder-decision-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.ladder-decision-notes {
  gap: 8px;
}

.ladder-table-shell {
  display: grid;
  gap: 10px;
}

.ladder-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(30, 36, 48, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.ladder-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

.ladder-table th,
.ladder-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(30, 36, 48, 0.08);
  text-align: left;
  white-space: nowrap;
}

.ladder-table th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.ladder-table td.cell-wrap,
.ladder-table th.cell-wrap {
  white-space: normal;
}

.open-orders-table {
  min-width: 920px;
  table-layout: fixed;
}

.open-orders-table th,
.open-orders-table td {
  padding: 9px 10px;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}

.open-orders-table th {
  font-size: 11px;
  line-height: 1.35;
}

.open-orders-table td {
  font-size: 13px;
  line-height: 1.35;
}

.open-order-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.open-order-main {
  font-weight: 600;
}

.open-order-meta {
  color: var(--muted);
  font-size: 12px;
}

.open-order-id {
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

.open-order-tp-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.open-order-tp-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(95, 108, 123, 0.08);
  border: 1px solid rgba(30, 36, 48, 0.08);
  font-size: 12px;
}

.open-order-tp-item strong {
  font-size: 12px;
}

.open-order-tp-item em {
  color: var(--muted);
  font-style: normal;
}

.ledger-history-table {
  min-width: 0;
  table-layout: fixed;
}

.ledger-history-table th,
.ledger-history-table td {
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}

.ledger-history-table th {
  font-size: 11px;
  line-height: 1.4;
}

.ledger-history-table td {
  font-size: 13px;
  line-height: 1.45;
}

.ledger-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ledger-stack-tight {
  gap: 4px;
}

.ledger-stack-line {
  min-width: 0;
}

.ledger-session-id {
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  word-break: break-all;
}

.ledger-inline-meta {
  color: var(--muted);
  font-size: 12px;
}

.ledger-tp-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ledger-tp-item {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
}

.ledger-tp-item strong {
  font-size: 12px;
}

.ledger-tp-price {
  font-size: 12px;
}

.ledger-tp-divider,
.ledger-tp-pct {
  color: var(--muted);
  font-size: 12px;
}

.ledger-history-table .table-badges {
  gap: 4px;
}

.ledger-history-table td:last-child,
.ledger-history-table th:last-child {
  text-align: left;
}

.ledger-history-table td:nth-child(7),
.ledger-history-table th:nth-child(7) {
  text-align: right;
}

.ladder-table td:last-child,
.ladder-table th:last-child {
  text-align: right;
}

.ladder-table th:first-child,
.ladder-table td:first-child,
.ladder-table th:nth-child(2),
.ladder-table td:nth-child(2) {
  text-align: left;
}

.ladder-focus-row {
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.ladder-focus-row:hover td {
  background: rgba(31, 117, 142, 0.06);
}

.ladder-focus-row.is-selected td {
  background: rgba(31, 117, 142, 0.1);
}

.ladder-reason-row td {
  padding-top: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}

.layer-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  line-height: 1;
  border: 1px solid transparent;
}

.layer-status-entry-planned,
.layer-status-protection-planned {
  background: rgba(30, 36, 48, 0.06);
  color: var(--muted);
}

.layer-status-entry-working,
.layer-status-protection-armed {
  background: rgba(31, 117, 142, 0.12);
  color: var(--teal);
  border-color: rgba(31, 117, 142, 0.18);
}

.layer-status-entry-filled,
.layer-status-protection-triggered,
.layer-status-entry-completed {
  background: rgba(46, 125, 50, 0.12);
  color: #2f6b34;
  border-color: rgba(46, 125, 50, 0.18);
}

.layer-status-entry-cancelled,
.layer-status-protection-inactive {
  background: rgba(173, 63, 35, 0.12);
  color: var(--accent);
  border-color: rgba(173, 63, 35, 0.18);
}

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

.chart-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
}

.chart-caption strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}

.chart-caption p {
  margin: 0;
  max-width: 32rem;
  line-height: 1.45;
  font-size: 13px;
}

.chart-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 12px;
}

.legend-swatch {
  display: inline-block;
  width: 16px;
  height: 6px;
  border-radius: 999px;
  margin-right: 6px;
}

.legend-bid {
  background: var(--teal);
}

.legend-ask {
  background: var(--accent);
}

.legend-mid {
  background: rgba(30, 36, 48, 0.5);
}

.legend-average {
  background: #1f758e;
}

.legend-stop {
  background: #ad3f23;
}

.legend-tp {
  background: #c38f00;
}

.legend-range {
  background: rgba(31, 117, 142, 0.24);
}

.legend-entry {
  background: rgba(31, 117, 142, 0.55);
}

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

.ladder-focus-shell[data-ladder-shell] [data-ladder-highlight] {
  opacity: 0.32;
  transition: opacity 0.16s ease, stroke-width 0.16s ease, filter 0.16s ease;
}

.ladder-focus-shell[data-ladder-shell=""] [data-ladder-highlight] {
  opacity: 1;
}

.ladder-focus-shell [data-ladder-highlight].is-highlighted {
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(31, 117, 142, 0.22));
}

.ladder-chart-line.is-highlighted {
  stroke-width: 3;
}

.ladder-chart-band.is-highlighted {
  opacity: 1;
  fill: rgba(31, 117, 142, 0.18);
}

.wall-chart {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.compact-status-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.compact-status-grid-primary {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.compact-status-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(18, 24, 38, 0.08);
  background: rgba(255, 255, 255, 0.78);
}

.compact-status-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.compact-status-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(18px, 1.6vw, 24px);
  line-height: 1.18;
}

.compact-status-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.compact-status-card strong.card-value-positive,
.compact-status-card strong.card-value-negative {
  display: block;
}

.order-execution-summary {
  margin-top: 12px;
}

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

.book-snapshot-grid .metric {
  min-height: 96px;
}

.wall-row {
  display: grid;
  grid-template-columns: minmax(120px, 150px) minmax(120px, 1fr) minmax(72px, 92px);
  gap: 10px;
  align-items: center;
}

.wall-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

.wall-side {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wall-bid {
  background: var(--teal-soft);
  color: var(--teal);
}

.wall-ask {
  background: var(--accent-soft);
  color: var(--accent);
}

.wall-bar-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: rgba(30, 36, 48, 0.08);
  overflow: hidden;
}

.wall-bar {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
}

.wall-value {
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

.subpanel,
.feature-card {
  padding: 20px;
  background: var(--panel-strong);
  min-width: 0;
}

.subpanel-highlight {
  background: linear-gradient(135deg, rgba(255, 250, 240, 0.98), rgba(246, 238, 219, 0.96));
  border-color: rgba(173, 63, 35, 0.2);
}

.stack-list {
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  font-size: 12px;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.badge-source {
  background: rgba(31, 117, 142, 0.12);
}

.badge-reply {
  background: rgba(173, 63, 35, 0.12);
}

.badge-media,
.badge-ocr {
  background: rgba(31, 117, 142, 0.12);
}

.badge-category {
  background: rgba(95, 108, 123, 0.1);
}

.badge-success {
  background: rgba(31, 117, 142, 0.12);
  color: var(--teal);
}

.badge-warn {
  background: rgba(195, 143, 0, 0.14);
  color: #8d6200;
}

.badge-danger {
  background: rgba(173, 63, 35, 0.12);
  color: var(--accent);
}

.badge-muted,
.badge-default {
  background: rgba(95, 108, 123, 0.1);
  color: var(--muted);
}

.table-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.record {
  padding: 22px;
}

.research-record {
  border-color: rgba(173, 63, 35, 0.18);
}

.record-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.record-meta {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.record-title {
  margin-bottom: 0;
  font-size: 24px;
}

.record-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.record-text {
  margin-top: 16px;
  line-height: 1.82;
  font-size: 17px;
  word-break: break-word;
}

.metric-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  margin-top: 16px;
}

.metric {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 18px;
}

.metric small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.media-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 18px;
}

.media-card {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
}

.media-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
}

.media-card p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  font-size: 13px;
}

.media-actions a {
  color: var(--teal);
}

.media-link {
  display: inline-flex;
  min-height: 120px;
  align-items: center;
}

.details-block {
  margin-top: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.details-block summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 700;
}

.details-panel {
  margin-top: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.details-panel summary {
  padding: 0;
  list-style: none;
}

.details-panel[open] summary {
  margin-bottom: 14px;
}

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

.ocr-stack,
.json-block {
  padding: 0 16px 16px;
}

.ocr-media-list {
  display: grid;
  gap: 14px;
}

.ocr-media-item {
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.ocr-block,
.code,
.json-block {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  border-radius: 16px;
  background: #1d2430;
  color: #f6f1e7;
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.endpoints-panel .code {
  max-height: 240px;
}

.pagination {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.pagination p {
  margin: 0;
  color: var(--muted);
  line-height: 1.2;
}

.pagination-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.pagination-actions .button {
  min-width: 92px;
  justify-content: center;
  line-height: 1.2;
  padding-top: 12px;
  padding-bottom: 12px;
}

.depth-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.depth-list {
  display: grid;
  gap: 10px;
}

.depth-list p {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.empty-state,
.loading-state {
  padding: 28px;
  text-align: center;
}

.error-state {
  border-color: rgba(173, 63, 35, 0.3);
  background: rgba(173, 63, 35, 0.08);
}

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

.small {
  font-size: 13px;
}

@media (max-width: 1360px) {
  .app-shell {
    grid-template-columns: 172px minmax(0, 1fr);
  }

  .system-primary-grid,
  .system-console-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1280px) {
  .execution-money-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .system-primary-grid,
  .system-console-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    max-width: calc(100vw - 12px);
    padding: 12px 8px 28px;
  }

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

  .sidebar {
    position: static;
    min-height: auto;
  }

  .shell-topbar,
  .panel,
  .card,
  .record,
  .feature-card,
  .subpanel,
  .empty-state,
  .loading-state {
    border-radius: 18px;
  }

  .record-head,
  .panel-head,
  .pagination {
    flex-direction: column;
    align-items: flex-start;
  }

  .record-links {
    justify-content: flex-start;
  }

  .module-nav {
    gap: 8px;
  }

  .book-snapshot-grid {
    grid-template-columns: 1fr;
  }

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

  .shell-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .shell-status {
    justify-content: flex-start;
    min-width: 0;
  }

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

  .execution-overview-grid,
  .execution-money-grid,
  .execution-money-grid-compact,
  .system-primary-grid,
  .system-decision-grid,
  .system-console-grid {
    grid-template-columns: 1fr;
  }

  .chart-caption {
    flex-direction: column;
  }

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

  .wall-value {
    text-align: left;
  }
}
