:root {
  --page: #121212;
  --line: #313131;
  --ink: #efede8;
  --sub: #aaa7a2;
}

body { font-size: 14px; }
.nav { padding: 14px max(20px, calc((100% - 1440px) / 2)); }
.brand { letter-spacing: .095em; }
.home-link { color: var(--sub); text-decoration: none; }
.home-link:hover { color: var(--ink); }
.workspace { width: min(calc(100% - 48px), 1440px); padding-block: 38px 64px; }
.workspace-header { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 32px; }
.network { color: var(--sub); margin: 0 0 8px; }
h1 { font-size: clamp(42px, 5vw, 62px); letter-spacing: -.055em; margin: 0; }
h2 { font-size: 19px; line-height: 1.2; font-weight: 600; letter-spacing: -.025em; margin: 0; }
.wallet-box { display: block; max-width: 320px; padding: 0; margin: 0; border: 0; background: none; text-align: right; }
.wallet-controls { justify-content: end; }
#wallet-status, #wallet-help { color: var(--sub); font-size: 12px; margin: 6px 0 0; overflow-wrap: anywhere; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); gap: 28px; align-items: start; }
.positions-panel { min-width: 0; border-top: 1px solid var(--line); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; }
.btn { min-height: 36px; padding: 6px 12px; border-radius: 4px; font-weight: 600; }
.btn.secondary { background: transparent; border-color: var(--line); }
.btn.secondary:hover { background: #222; border-color: #726458; }
.btn:disabled { pointer-events: none; }
.muted { color: var(--sub); margin: 0 0 14px; font-size: 13px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 710px; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { font-weight: 500; font-size: 12px; color: var(--sub); white-space: nowrap; }
tbody th { font-weight: 600; }
td:nth-child(8) { min-width: 122px; }
.trade-units { display: block; color: var(--sub); font-size: 11px; }
[data-drift=outside] { color: var(--accent); }
.stock-id { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.stock-id img { width: 21px; height: 21px; object-fit: contain; }
.stock-id:hover { text-decoration: underline; }
input { width: 100%; min-width: 0; padding: 6px; border: 1px solid #3b3b3b; border-radius: 3px; background: #181818; color: var(--ink); font-variant-numeric: tabular-nums; }
td input { min-width: 60px; max-width: 88px; }
td input:invalid:not(:placeholder-shown) { border-color: var(--accent); }
.asset-symbol { width: 80px; text-transform: uppercase; }
.row-remove, .text-button { padding: 0; border: 0; background: transparent; color: var(--sub); font-size: 12px; cursor: pointer; }
.row-remove:hover, .text-button:hover { color: var(--ink); text-decoration: underline; }
.quote-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 0 20px; color: var(--sub); font-size: 12px; }
.quote-line p { margin: 0; }
.quote-line button { flex: 0 0 auto; }
.policy { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0; margin: 10px 0 0; border: 0; }
.policy legend { padding: 0; margin-bottom: 10px; font-weight: 600; }
.policy label span { display: block; color: var(--sub); font-size: 12px; margin-bottom: 5px; }
.policy input { max-width: 160px; }
.agent-panel { padding: 0 17px; border: 1px solid var(--line); background: #171717; }
#decision { margin: 0 0 15px; font-size: 16px; line-height: 1.45; font-weight: 600; }
#decision[data-status=rebalance], #decision[data-status=cost_blocked] { color: var(--accent); }
.decision-reasons, .readouts { margin: 0; }
.decision-reasons { border-top: 1px solid var(--line); padding-top: 13px; }
.decision-reasons div { margin-bottom: 12px; }
.decision-reasons dt { font-size: 12px; color: var(--sub); }
.decision-reasons dd { margin: 1px 0 0; line-height: 1.4; }
.readouts { display: block; padding: 7px 0; border-top: 1px solid var(--line); }
.readouts div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 0; font-size: 13px; }
.readouts dt { color: var(--sub); }
.readouts dd { margin: 0; font-variant-numeric: tabular-nums; }
.agent-details { border-top: 1px solid var(--line); padding: 11px 0; }
.agent-details summary { cursor: pointer; }
.agent-details p, .agent-details button, .agent-details label, .agent-details a { margin: 8px 0 0; }
.agent-details label, .agent-details a { display: block; font-size: 12px; overflow-wrap: anywhere; }
.explanation { color: var(--sub); white-space: pre-line; }
.explanation:empty { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1050px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 540px) {
  .workspace { width: calc(100% - 32px); padding-top: 24px; }
  .workspace-header { align-items: start; flex-direction: column; margin-bottom: 24px; }
  .wallet-box { text-align: left; }
  .wallet-controls { justify-content: start; }
  .policy { gap: 10px; }
  .policy label { line-height: 1.3; }
}
.quote-time { display: block; color: var(--sub); font-size: 11px; white-space: nowrap; }
.agent-details input { display: block; margin-top: 8px; font-size: 12px; }
