.pivot-page-head {
  padding-bottom: 6px;
}

.pivot-page-head h1 {
  font-weight: 400;
}

.pivot-shell {
  min-width: 0;
}

.pivot-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.pivot-field {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .08em;
}

.pivot-field input {
  display: block;
  width: 100%;
  min-height: 36px;
  margin-top: 4px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  background: var(--foreground);
  color: var(--body-text);
  caret-color: var(--accent);
  font-family: var(--mono);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.pivot-field input:focus,
.pivot-orbit-start input:focus,
.pivot-lag-wrap input:focus {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}

.pivot-orbit-manager {
  margin-top: 9px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--foreground);
}

.pivot-orbit-head,
.pivot-ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pivot-orbit-head .eyebrow,
.pivot-ledger-head .eyebrow {
  margin: 0;
}

.pivot-orbit-list {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

.pivot-orbit-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 43px 28px;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.pivot-orbit-row.is-active {
  border-color: color-mix(in srgb, var(--accent) 24%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.pivot-orbit-row:first-child {
  grid-template-columns: 44px minmax(0, 1fr) 43px;
}

.pivot-orbit-select,
.pivot-orbit-visibility,
.pivot-orbit-remove,
.pivot-mode-row button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--body-text);
  font-family: var(--mono);
}

.pivot-orbit-select {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 6px;
  color: var(--accent);
  font-size: 8px;
}

.pivot-orbit-dot {
  display: block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.pivot-orbit-start {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
}

.pivot-orbit-start input,
.pivot-lag-wrap input {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: var(--panel-2);
  color: var(--body-text);
  caret-color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pivot-orbit-primary-value {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--body-text);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pivot-orbit-visibility,
.pivot-orbit-remove {
  min-height: 30px;
  padding: 4px;
  color: var(--muted);
  font-size: 7px;
  letter-spacing: .04em;
}

.pivot-orbit-visibility[aria-pressed="false"] {
  opacity: .5;
}

.pivot-orbit-remove {
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
}

.pivot-regime-line {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 7px;
  margin: 9px 1px 2px;
  overflow: hidden;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pivot-regime {
  color: var(--accent);
  font-size: 9px;
  letter-spacing: .05em;
}

.pivot-regime-detail {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
}

.pivot-return-line {
  margin: 0 1px 6px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pivot-graph-panel {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--foreground);
}

.pivot-mode-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  margin-bottom: 7px;
}

.pivot-mode-row button {
  min-height: 29px;
  padding: 4px 9px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .05em;
}

.pivot-mode-row button.is-active {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}

.pivot-lag-wrap {
  display: none;
  min-width: 0;
  align-items: center;
  gap: 5px;
  margin: 0 0 0 auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .06em;
}

.pivot-lag-wrap.is-visible {
  display: flex;
}

.pivot-lag-wrap input {
  width: 54px;
  min-height: 29px;
  font-size: 11px;
}

.pivot-graph-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.pivot-graph-head .eyebrow {
  margin-bottom: 1px;
}

.pivot-graph-head > div > span,
.pivot-selected-readout {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
}

.pivot-selected-readout {
  max-width: 66%;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pivot-canvas {
  display: block;
  width: 100%;
  height: 360px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 8px;
  background: var(--foreground);
  touch-action: manipulation;
}

.pivot-zoom-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 58px 52px;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
}

.pivot-zoom-row label {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .08em;
}

.pivot-zoom-row input[type="range"] {
  width: 100%;
  min-width: 0;
  accent-color: var(--accent);
}

.pivot-zoom-row output {
  overflow: hidden;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pivot-mini-button {
  min-height: 28px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .06em;
}

.pivot-mini-button:disabled {
  color: var(--muted);
  opacity: .55;
}

.pivot-mini-button:active,
.pivot-orbit-select:active,
.pivot-orbit-visibility:active,
.pivot-orbit-remove:active,
.pivot-mode-row button:active {
  background: var(--panel-2);
}

.pivot-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-top: 7px;
}

.pivot-stats > div {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--foreground);
}

.pivot-stats span,
.pivot-stats small,
.pivot-stats strong {
  display: block;
}

.pivot-stats span,
.pivot-stats small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 7.5px;
  line-height: 1.2;
}

.pivot-stats strong {
  margin-top: 3px;
  overflow: hidden;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pivot-stats small {
  margin-top: 2px;
  font-size: 6.8px;
}

.pivot-ledger {
  margin-top: 11px;
}

.pivot-ledger-head {
  margin: 0 1px 5px;
}

.pivot-ledger-head > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.pivot-table-wrap {
  max-height: 390px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--foreground);
  -webkit-overflow-scrolling: touch;
}

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

.pivot-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-2);
}

.pivot-table th,
.pivot-table td {
  padding: 6px 9px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.pivot-table th {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
}

.pivot-table th:first-child,
.pivot-table td:first-child {
  width: 52px;
  color: var(--muted);
  text-align: left;
}

.pivot-table tbody tr {
  color: var(--body-text);
  cursor: pointer;
  outline: none;
}

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

.pivot-table tbody tr.is-selected {
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  color: var(--accent);
}

.pivot-table tbody tr:focus-visible {
  box-shadow: inset 0 0 0 1px var(--accent);
}

@media (max-width: 480px) {
  .pivot-canvas {
    height: 340px;
  }

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

  .pivot-orbit-row {
    grid-template-columns: 42px minmax(0, 1fr) 41px 28px;
  }

  .pivot-orbit-row:first-child {
    grid-template-columns: 42px minmax(0, 1fr) 41px;
  }

  .pivot-mode-row {
    flex-wrap: wrap;
  }

  .pivot-lag-wrap {
    margin-left: 0;
  }
}
