:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d9dee6;
  --text: #14171f;
  --muted: #5e6675;
  --accent: #1677ff;
  --accent-2: #119c69;
  --danger: #c63737;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.active,
button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.danger {
  color: var(--danger);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 15px;
}

#status {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.actions,
.form-actions,
.segmented {
  display: flex;
  align-items: center;
  gap: 8px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(250px, 340px) minmax(520px, 1fr);
  grid-template-areas:
    "monitors editor"
    "alerts editor";
  gap: 16px;
  padding: 16px;
  align-items: start;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(320px, 420px);
  grid-template-areas: "monitors detail";
  gap: 16px;
  max-width: 1500px;
  margin: 0 auto;
}

.legacy-hidden {
  display: none;
}

.page-hidden {
  display: none !important;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.builder-head {
  flex-direction: row;
}

.monitor-list {
  grid-area: monitors;
}

.dashboard-layout .monitor-list {
  grid-area: monitors;
}

.monitor-detail {
  grid-area: detail;
}

.alerts-page {
  grid-column: 1 / -1;
}

.logs-page {
  grid-column: 1 / -1;
}

.log-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.log-stats span {
  background: #eef4ff;
  border-radius: 999px;
  color: #1d5fd6;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
}

.logs-list {
  display: grid;
  gap: 6px;
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding: 10px;
}

.log-row {
  align-items: start;
  border: 1px solid var(--line);
  border-left: 4px solid #98a2b3;
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 8px 10px;
}

.log-row.ok {
  border-left-color: var(--accent-2);
}

.log-row.hot {
  border-left-color: #7c3aed;
}

.log-row.error {
  border-left-color: var(--danger);
  background: #fff7f7;
}

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

.log-main strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-time {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.log-pill {
  background: #f2f4f7;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  padding: 3px 7px;
  text-transform: uppercase;
}

.log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-left: 72px;
}

.log-meta span {
  background: #f7f8fa;
  border-radius: 999px;
  color: #475467;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
}

.editor {
  grid-area: editor;
}

.alerts {
  grid-area: alerts;
}

.list {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.item-card button {
  height: auto;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.item-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}

.item-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.empty-state {
  display: grid;
  gap: 4px;
  padding: 28px;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.empty-state strong {
  color: var(--text);
}

.monitor-group {
  display: grid;
  gap: 4px;
}

.monitor-group-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 4px 2px;
}

.monitor-group-head h3 {
  margin: 0;
  font-size: 13px;
}

.monitor-group-head span {
  color: var(--muted);
  font-size: 11px;
}

.status-filter {
  align-items: end;
  display: grid;
  gap: 4px;
  min-width: 130px;
}

.status-filter span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.status-filter select {
  height: 30px;
}

.monitor-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.monitor-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 11px;
}

.monitor-table th,
.monitor-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  color: #344054;
  text-align: left;
  white-space: nowrap;
}

.monitor-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.monitor-table tbody tr {
  cursor: pointer;
}

.monitor-table tbody tr:hover {
  background: #f8fbff;
}

.monitor-table tr.selected {
  background: #eef4ff;
  box-shadow: inset 3px 0 0 var(--accent);
}

.monitor-table tr.triggered {
  background: #fffaf0;
}

.monitor-table .monitor-group-row td {
  background: #f8fafc;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.monitor-table .monitor-group-row span {
  margin-left: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

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

.monitor-item-cell {
  min-width: 180px;
}

.monitor-item-cell strong,
.monitor-item-cell span {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monitor-item-cell strong {
  color: var(--text);
  font-size: 12px;
}

.monitor-item-cell span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.monitor-result {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monitor-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  cursor: pointer;
}

.monitor-card.triggered {
  border-color: #f0b35a;
  background: #fffaf0;
}

.monitor-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.12);
}

.monitor-card-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.monitor-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.monitor-title-row h4 {
  margin: 0;
  font-size: 15px;
}

.monitor-title-row p,
.monitor-reason,
.monitor-rule {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.monitor-rule {
  color: #344054;
}

.time-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.time-row span {
  white-space: nowrap;
}

.badge-row,
.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge,
.metric,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge {
  background: #eef4ff;
  color: #175cd3;
}

.metric {
  background: #f2f4f7;
  color: #344054;
}

.status-pill {
  background: #ecfdf3;
  color: #087443;
}

.status-pill.hot {
  background: #fff1f0;
  color: #b42318;
}

.status-pill.failed {
  background: #fff1f0;
  color: #b42318;
}

.status-pill.idle {
  background: #f2f4f7;
  color: #475467;
}

.monitor-actions {
  display: flex;
  align-items: start;
  gap: 6px;
}

.table-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.table-actions button {
  height: 24px;
  padding: 0 7px;
  font-size: 11px;
}

.detail-panel {
  padding: 14px;
}

.detail-stack {
  display: grid;
  gap: 12px;
}

.detail-section {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.detail-section h4,
.detail-title h3 {
  margin: 0;
}

.detail-section h4 {
  font-size: 13px;
}

.detail-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.detail-title p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.detail-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  font-size: 12px;
}

.detail-row span {
  color: var(--muted);
  font-weight: 700;
}

.detail-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.detail-json {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-json summary {
  cursor: pointer;
  padding: 10px 12px;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.detail-json pre {
  margin: 0;
  max-height: 240px;
  overflow: auto;
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  color: #344054;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.4;
}

.alerts-table {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
}

.alert-card {
  display: grid;
  flex: 1 1 260px;
  max-width: 300px;
  min-width: 240px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.alert-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #172131;
  color: #fff;
  padding: 10px 12px;
}

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

.alert-item img {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
  image-rendering: pixelated;
}

.alert-item h3 {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cheap-pill {
  border-radius: 999px;
  background: #45e3a1;
  color: #07111f;
  flex: 0 0 auto;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 4px 8px;
}

.alert-card-body {
  display: grid;
  padding: 12px;
  gap: 0;
}

.price-lines {
  display: grid;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.price-lines div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.price-lines span {
  color: #64748b;
  font-size: 11px;
  white-space: nowrap;
}

.price-lines strong {
  color: #1e40af;
  font-size: 13px;
  font-weight: 600;
  text-align: right;
}

.price-lines strong.profit-positive {
  color: #079455;
}

.price-lines strong.profit-negative {
  color: var(--danger);
}

.alert-gap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ecfdf3;
  border-radius: 7px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.alert-gap-pct {
  font-size: 20px;
  font-weight: 800;
  color: #079455;
  line-height: 1;
}

.alert-gap-neso {
  font-size: 11px;
  color: #079455;
  font-weight: 500;
  text-align: right;
}

.alert-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 10px;
}

.alert-card-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.alert-card-actions a,
.alert-card-actions button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 8px;
  text-decoration: none;
  white-space: nowrap;
}

.alert-card-actions button {
  background: #172131;
}

form {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.grid {
  display: grid;
  gap: 12px;
}

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

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

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

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

input,
select {
  height: 32px;
  padding: 0 8px;
}

textarea {
  min-height: 96px;
  padding: 8px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.checkline {
  display: flex;
  align-items: center;
  align-self: end;
  height: 38px;
}

.checkline input {
  width: 18px;
  height: 18px;
}

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

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

.builder-section {
  display: grid;
  gap: 12px;
  padding: 2px 0 8px;
}

.builder-section + .builder-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.step-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

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

.strategy-card {
  display: grid;
  gap: 6px;
  height: auto;
  min-height: 92px;
  padding: 14px;
  text-align: left;
  border-radius: 8px;
  background: #fff;
}

.strategy-card strong {
  font-size: 15px;
}

.strategy-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.strategy-card.active {
  background: #eef5ff;
  border-color: var(--accent);
  color: var(--text);
}

.rule-sentence {
  border: 1px solid #b8d6ff;
  border-radius: 8px;
  background: #f3f8ff;
  color: #183b67;
  padding: 12px;
  font-size: 14px;
  line-height: 1.45;
}

.condition-summary {
  display: none;
  border: 1px solid #dfe4eb;
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
}

.condition-summary.open {
  display: block;
}

.switch {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.switch input {
  width: 18px;
  height: 18px;
}

.link-button {
  width: fit-content;
  border: 0;
  padding: 0;
  height: auto;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

.advanced-json {
  display: none;
  gap: 10px;
}

.advanced-json.open {
  display: grid;
}

.json-help {
  color: var(--muted);
  font-size: 13px;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal.open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 23, 31, 0.45);
}

.modal-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  margin: 10px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.modal-panel.resell-panel {
  max-width: 620px;
}

.modal-body {
  display: grid;
  gap: 10px;
  padding: 10px;
  overflow: auto;
}

.search-wrap {
  position: relative;
  z-index: 3;
}

.suggestions {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(20, 23, 31, 0.18);
  padding: 6px;
}

.suggestions.open {
  display: grid;
  gap: 4px;
}

.suggestion {
  height: 30px;
  justify-content: flex-start;
  border-color: #c8d7ec;
  background: #f7fbff;
  text-align: left;
}

.preview-area {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 520px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding: 8px;
}

.preview-empty {
  color: var(--muted);
}

.modal-create-bar {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) max-content;
  gap: 8px;
  align-items: end;
}

.resell-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.resell-summary {
  display: grid;
  gap: 12px;
}

.resell-item-line {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.resell-item-line img {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  object-fit: contain;
  image-rendering: pixelated;
}

.resell-item-line strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

.resell-item-line span,
.resell-reason,
.resell-warning {
  color: var(--muted);
  font-size: 12px;
}

.resell-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.resell-metrics div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
}

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

.resell-metrics strong {
  color: var(--accent);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.resell-metrics .profit-positive {
  color: #079455;
}

.resell-metrics .profit-negative {
  color: var(--danger);
}

.resell-warning {
  border-radius: 7px;
  background: #fff7ed;
  color: #9a3412;
  padding: 9px 10px;
}

.modal-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 10px;
  min-height: 0;
}

.condition-side {
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.condition-side h2,
.preset-box h2 {
  font-size: 13px;
}

.condition-side p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.preset-box {
  display: grid;
  gap: 8px;
}

.compact-grid {
  gap: 8px;
}

.starforce-fields {
  display: none;
}

.compact-check {
  height: auto;
  align-self: auto;
}

.custom-formula {
  display: none;
}

.custom-formula.open {
  display: grid;
}

.potential-match-fields {
  display: none;
  gap: 10px;
}

.potential-match-fields.open {
  display: grid;
}

.tier-misprice-fields {
  display: none;
}

.tier-misprice-fields.open {
  display: grid;
}

.grade-range {
  display: grid;
  gap: 6px;
}

.range-title {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.grade-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding-top: 2px;
  touch-action: none;
  user-select: none;
}

.grade-row button {
  display: grid;
  place-items: center;
  gap: 2px;
  height: 42px;
  padding: 3px;
  border-color: #d7dce5;
  background: #fff;
  font-weight: 900;
  overflow: visible;
  position: relative;
}

.grade-row button span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.grade-row button.in-range {
  border-color: #12a37f;
  background: #e9fbf6;
  color: #08745b;
}

.grade-row button.endpoint {
  background: #12a37f;
  color: #fff;
}

.grade-row button.endpoint span {
  color: #fff;
}

.grade-row.dragging button {
  cursor: grabbing;
}

.range-handle {
  align-items: center;
  background: #101828;
  border: 1px solid #fff;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.2);
  color: #fff !important;
  cursor: grab;
  display: inline-flex;
  font-size: 8px !important;
  font-weight: 900 !important;
  height: 14px;
  justify-content: center;
  letter-spacing: 0;
  line-height: 1;
  min-width: 24px;
  padding: 0 4px;
  position: absolute;
  top: -8px;
  z-index: 2;
}

.range-handle.min {
  left: 4px;
}

.range-handle.max {
  right: 4px;
}

.range-handle.min.max,
.grade-row button .range-handle.min + .range-handle.max {
  transform: translateY(-8px);
}

.potential-options {
  display: grid;
  gap: 8px;
}

.potential-criteria-group {
  display: grid;
  gap: 5px;
}

.potential-criterion {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 64px 64px;
  gap: 5px;
  align-items: end;
}

.potential-criterion strong {
  align-self: center;
  color: var(--muted);
  font-size: 11px;
}

.potential-criterion.any input,
.potential-criterion.any select[data-field="unit"] {
  background: #f4f6f8;
  color: #98a2b3;
}

.preview-head {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.preview-head img {
  width: 42px;
  height: 42px;
  image-rendering: pixelated;
}

.preview-warning {
  margin-bottom: 8px;
  border: 1px solid #f0b35a;
  border-radius: 6px;
  background: #fffaf0;
  color: #8a4b00;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  padding: 8px;
}

.response-tree {
  display: grid;
  align-content: start;
  gap: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.tree-node {
  margin-left: calc(var(--depth) * 12px);
}

.tree-node summary {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  cursor: pointer;
  list-style: none;
}

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

.tree-node summary::before {
  content: "▸";
  color: #3f4652;
  font-size: 12px;
}

.tree-node[open] > summary::before {
  content: "▾";
}

.tree-row {
  display: grid;
  grid-template-columns: max-content minmax(120px, 1fr);
  align-items: start;
  gap: 8px;
  width: 100%;
  height: auto;
  margin-left: calc(var(--depth) * 12px + 14px);
  padding: 1px 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.tree-row:hover .tree-key,
.tree-node summary:hover .tree-key {
  background: #0d8f72;
}

.tree-key {
  display: inline-block;
  max-width: 360px;
  overflow-wrap: anywhere;
  border-radius: 5px;
  background: #12a37f;
  color: #fff;
  padding: 2px 6px;
  line-height: 1.25;
}

.tree-value {
  overflow-wrap: anywhere;
  color: #7a7d84;
  padding-top: 3px;
  line-height: 1.35;
}


.triggered {
  border-color: var(--accent-2);
  background: #f1fbf6;
}

@media (max-width: 980px) {
  .layout,
  .dashboard-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "monitors"
      "detail";
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .strategy-grid,
  .json-grid {
    grid-template-columns: 1fr;
  }

  .modal-workspace {
    grid-template-columns: 1fr;
  }

  .condition-side,
  .preview-area {
    max-height: none;
    min-height: 260px;
  }


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

.runs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.runs-table th,
.runs-table td {
  padding: 4px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border, #2a2a2a);
  white-space: nowrap;
}
.runs-table th:first-child,
.runs-table td:first-child {
  text-align: left;
}
.runs-table thead th {
  color: var(--text-muted, #888);
  font-weight: 500;
}
.runs-table tr.status-triggered td {
  color: var(--accent, #f0b429);
}
.runs-table tr.status-error td {
  color: var(--danger, #e55);
}
.empty-hint {
  color: var(--text-muted, #888);
  font-size: 0.82rem;
  margin: 8px 0;
}

.trades-content {
  padding: 16px;
  display: grid;
  gap: 24px;
}

.trades-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}

.trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.trades-table th,
.trades-table td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--line, #e2e8f0);
  white-space: nowrap;
}

.trades-table th:first-child,
.trades-table td:first-child {
  text-align: left;
  width: 100%;
}

.trades-table thead th {
  color: var(--text-muted, #64748b);
  font-size: 11px;
  font-weight: 500;
}

.trade-status {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  text-transform: uppercase;
}

.trade-pending { background: #fef9c3; color: #854d0e; }
.trade-listed  { background: #dbeafe; color: #1e40af; }
.trade-sold    { background: #dcfce7; color: #166534; }
.trade-failed  { background: #fee2e2; color: #991b1b; }

.trades-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.trades-stat {
  display: grid;
  gap: 4px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 150px;
}

.trades-stat span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.trades-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.universal-runs-header {
  padding: 16px 16px 4px;
  border-top: 1px solid var(--border, #2a2a2a);
  margin-top: 8px;
}
.universal-runs-header h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted, #888);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}
.universal-runs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 8px 16px 16px;
}
.universal-runs-block {
  border: 1px solid var(--border, #2a2a2a);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
}
.universal-runs-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #888);
  margin: 0 0 6px 0;
}
