* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Cambria, "Book Antiqua", "Palatino Linotype", Palatino, serif;
  background: #f5f7fa;
  color: #17212b;
}

.positive {
  color: #4a9f2b !important;
}

.negative {
  color: #df4b53 !important;
}

button,
input,
select {
  font: inherit;
}

.page {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 72px;
}

.login-shell {
  width: 100%;
  max-width: 360px;
}

.login-panel .panel-head h1 {
  font-size: 24px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 12px;
}

.login-field {
  gap: 8px;
}

.login-field input {
  width: 100%;
}

.login-error {
  min-height: 18px;
  color: #9b1c1c;
  font-size: 13px;
}

.login-actions {
  margin-top: 4px;
  gap: 10px;
}

.login-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  color: #334e68;
  text-decoration: none;
  background: #fff;
}

.topbar,
.band {
  margin-bottom: 16px;
}

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

.page-nav {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.page-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 8px 12px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
  color: #334e68;
  text-decoration: none;
  font-size: 13px;
}

.page-nav a.active {
  background: #eef4ff;
  border-color: #bfd3f7;
  color: #0b4fd6;
}

.topbar h1,
.panel-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.topbar p,
.panel-head p,
#chainMeta {
  margin: 0;
  color: #52606d;
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(420px, 0.9fr);
  gap: 16px;
}

.panel {
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 16px;
}

.config-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auto-entry-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(320px, 1.2fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.auto-entry-panel h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.auto-entry-panel p {
  margin: 0;
  color: #52606d;
  font-size: 13px;
}

.switch-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #334e68;
  font-weight: 600;
}

.switch-line input {
  width: 20px;
  height: 20px;
}

.auto-entry-action {
  min-width: 168px;
  justify-self: center;
  font-weight: 700;
  border-width: 1px;
}

.auto-entry-action-pause {
  color: #9b1c1c;
  border-color: #f3b6b6;
  background: #fffafa;
}

.auto-entry-action-start {
  color: #fff;
  border-color: #2f8132;
  background: #2f8132;
}

.auto-entry-action-start:hover {
  background: #276b2a;
}

.emergency-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin: -6px 0 16px;
  border-color: #f3b6b6;
  background: #fffafa;
}

.emergency-panel h2 {
  margin: 0 0 6px;
  font-size: 22px;
  color: #7f1d1d;
}

.emergency-panel p {
  margin: 0;
  color: #7b8794;
  font-size: 13px;
}

.emergency-actions {
  display: inline-flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.emergency-btn {
  font-weight: 700;
}

.emergency-orderly {
  color: #9b1c1c;
  border-color: #f3b6b6;
  background: #fff;
}

.emergency-fast {
  color: #fff;
  border-color: #9b1c1c;
  background: #9b1c1c;
}

.emergency-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.global-exit-confirm {
  grid-column: 1 / -1;
  border: 1px solid #f3b6b6;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.global-exit-confirm strong {
  display: block;
  margin-bottom: 6px;
  color: #7f1d1d;
}

.global-exit-confirm p {
  margin: 0 0 12px;
}

.global-exit-confirm-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.auto-entry-budget {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.auto-entry-budget span {
  display: inline-flex;
  gap: 4px;
  padding: 4px 7px;
  border: 1px solid #e4e7eb;
  border-radius: 6px;
  background: #fff;
  color: #52606d;
  font-size: 12px;
}

.auto-entry-budget strong {
  color: #243b53;
}

.config-panel {
  margin-bottom: 14px;
}

.config-grid {
  display: grid;
  gap: 8px;
}

.config-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 190px minmax(220px, 1.25fr);
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid #eef2f7;
}

.config-row:first-child {
  border-top: 0;
}

.config-row-text {
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.2fr) 170px minmax(220px, 1fr);
  align-items: start;
}

.config-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.config-label strong {
  font-size: 14px;
  color: #17212b;
}

.config-label span,
.config-meta,
.config-help {
  font-size: 12px;
  color: #6b7c8f;
}

.config-control input,
.config-control textarea {
  width: 100%;
}

.config-control textarea {
  min-height: 76px;
  resize: vertical;
}

.config-control input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

.config-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.config-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.config-switch-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 48px;
  height: 26px;
  padding: 3px;
  border-radius: 999px;
  background: #d9e2ec;
  border: 1px solid #bcccdc;
  transition: background 160ms ease, border-color 160ms ease;
}

.config-switch-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.22);
  transform: translateX(0);
  transition: transform 160ms ease;
}

.config-switch input:checked + .config-switch-track {
  background: #0b6bcb;
  border-color: #0b6bcb;
}

.config-switch input:checked + .config-switch-track .config-switch-thumb {
  transform: translateX(22px);
}

.config-switch input:focus-visible + .config-switch-track {
  outline: 2px solid #84c5f4;
  outline-offset: 2px;
}

.config-switch input:disabled + .config-switch-track {
  opacity: 0.55;
}

.config-switch:has(input:disabled) {
  cursor: not-allowed;
}

.config-switch-text {
  min-width: 24px;
  font-size: 13px;
  font-weight: 700;
  color: #334e68;
}

.config-advanced {
  margin-top: 4px;
}

.config-advanced summary {
  cursor: pointer;
  color: #334e68;
  font-weight: 600;
  margin: 8px 0 12px;
}

.config-savebar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0 2px;
  background: #f5f7fa;
}

.panel-subhead {
  margin: 14px 0 8px;
  font-size: 13px;
  color: #486581;
  font-weight: 600;
}

.panel-subhead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.summary-grid,
.monitoring-defaults-grid {
  display: grid;
  gap: 12px;
}

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

.monitoring-defaults-grid {
  grid-template-columns: 1fr;
}

.summary-card,
.monitoring-card {
  padding: 14px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-card {
  padding: 10px 14px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
  border-left-width: 4px;
  border-left-color: #d9e2ec;
}

.info-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.info-card-head h2 {
  margin: 0;
  font-size: 18px;
  flex: 0 0 180px;
}

.info-bias {
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
}

.info-note {
  margin: 6px 0 0;
  color: #9b1c1c;
  font-size: 13px;
}

.info-inline-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  flex: 1 1 auto;
}

.info-metric {
  min-width: 0;
}

.info-metric-label {
  font-size: 12px;
  color: #486581;
  margin-bottom: 4px;
}

.info-metric-value {
  font-size: 15px;
  font-weight: 600;
}

.strength-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.strength-label {
  flex: 0 0 92px;
  font-size: 12px;
  color: #486581;
}

.strength-track {
  flex: 1 1 auto;
  height: 8px;
  display: grid;
  grid-template-columns: repeat(var(--segments, 1), minmax(0, 1fr));
  gap: 1px;
  padding: 0;
  background: #d7dee7;
  border-radius: 999px;
  overflow: hidden;
}

.strength-segment {
  height: 100%;
  min-width: 0;
}

.strength-segment-pending {
  background: #e5e7eb;
}

.info-controls {
  align-items: center;
}

.info-controls label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.info-controls select {
  width: auto;
  min-width: 88px;
}

.info-controls button {
  align-self: center;
}

.risk-panel .panel-head {
  margin-bottom: 10px;
}

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

.risk-regime {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.risk-regime-stable {
  color: #045d56;
  background: #dff8ee;
}

.risk-regime-watch {
  color: #7c4a03;
  background: #fff2c7;
}

.risk-regime-high {
  color: #fff;
  background: #c02626;
}

.risk-regime-unknown {
  color: #52606d;
  background: #eef2f7;
}

.risk-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.risk-empty {
  padding: 8px 10px;
  border: 1px solid #e4e7eb;
  border-radius: 6px;
  color: #52606d;
  background: #f8fafc;
  font-size: 13px;
}

.risk-item {
  padding: 9px 10px;
  border: 1px solid #e4e7eb;
  border-left: 4px solid #94a3b8;
  border-radius: 6px;
  background: #fff;
}

.risk-item-watch {
  border-left-color: #d97706;
}

.risk-item-high {
  border-left-color: #dc2626;
}

.risk-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.risk-badge-watch {
  color: #7c4a03;
  background: #fff2c7;
}

.risk-badge-high {
  color: #fff;
  background: #dc2626;
}

.risk-badge-info {
  color: #334e68;
  background: #e4e7eb;
}

.risk-type {
  font-size: 12px;
  font-weight: 700;
  color: #334e68;
}

.risk-source {
  margin-left: auto;
  font-size: 12px;
  color: #697586;
}

.risk-headline {
  display: block;
  color: #17212b;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.25;
}

a.risk-headline:hover {
  text-decoration: underline;
}

.risk-why {
  margin-top: 3px;
  color: #52606d;
  font-size: 13px;
  line-height: 1.3;
}

.risk-item-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}

.risk-reader-btn {
  padding: 4px 10px;
  font-size: 12px;
}

.risk-more-btn {
  align-self: flex-start;
  margin-top: 2px;
}

.reader-open {
  overflow: hidden;
}

.reader-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.38);
}

.reader-overlay[hidden] {
  display: none;
}

.reader-modal {
  width: min(820px, 100%);
  max-height: min(88vh, 920px);
  display: flex;
  flex-direction: column;
  border: 1px solid #dce4ee;
  border-radius: 8px;
  background: #fdfdfb;
  box-shadow: 0 20px 56px rgba(15, 23, 42, 0.2);
}

.reader-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid #e4e7eb;
}

.reader-title-wrap {
  min-width: 0;
}

.reader-head h2 {
  margin: 4px 0 0;
  color: #17212b;
  font-size: 25px;
  line-height: 1.2;
}

.reader-source,
.reader-meta {
  color: #697586;
  font-size: 12px;
}

.reader-close {
  align-self: flex-start;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid #d8e0ea;
  border-radius: 50%;
  padding: 0;
  color: #334e68;
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.reader-close:hover {
  background: #f8fafc;
}

.reader-meta {
  margin-top: 8px;
}

.reader-body {
  flex: 1;
  overflow: auto;
  min-height: 180px;
  padding: 20px 24px 24px;
  color: #243041;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.68;
}

.reader-body p {
  margin: 0 0 16px;
}

.reader-body h3 {
  margin: 16px 0 8px;
  color: #17212b;
  font-family: inherit;
  font-size: 20px;
  line-height: 1.35;
}

.reader-body.reader-loading {
  color: #697586;
  font-family: inherit;
  font-size: 15px;
}

.reader-body.reader-error {
  color: #9f1d1d;
  font-family: inherit;
  font-size: 15px;
}

.reader-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 24px 16px;
  border-top: 1px solid #e4e7eb;
}

.reader-footer a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid #bfd2f3;
  border-radius: 999px;
  color: #175cd3;
  background: #f4f8ff;
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 700px) {
  .reader-overlay {
    align-items: stretch;
    padding: 8px;
  }

  .reader-modal {
    max-height: calc(100vh - 16px);
  }

  .reader-head {
    padding: 16px 16px 12px;
  }

  .reader-head h2 {
    font-size: 21px;
  }

  .reader-body {
    padding: 16px;
    font-size: 17px;
  }

  .reader-footer {
    padding: 10px 16px 14px;
  }
}

.bias-neutral {
  background: #94a3b8;
}

.bias-bull-1 {
  background: #86efac;
}

.bias-bull-2 {
  background: #4ade80;
}

.bias-bull-3 {
  background: #16a34a;
}

.bias-bear-1 {
  background: #fca5a5;
}

.bias-bear-2 {
  background: #f87171;
}

.bias-bear-3 {
  background: #dc2626;
}

.bias-pill-neutral {
  background: #f1f5f9;
  color: #475569;
}

.bias-pill-bull-1 {
  background: #dcfce7;
  color: #166534;
}

.bias-pill-bull-2 {
  background: #bbf7d0;
  color: #166534;
}

.bias-pill-bull-3 {
  background: #86efac;
  color: #14532d;
}

.bias-pill-bear-1 {
  background: #fee2e2;
  color: #991b1b;
}

.bias-pill-bear-2 {
  background: #fecaca;
  color: #991b1b;
}

.bias-pill-bear-3 {
  background: #fca5a5;
  color: #7f1d1d;
}

.summary-card-label {
  color: #486581;
  font-size: 13px;
  margin-bottom: 8px;
}

.summary-card-value {
  font-size: 24px;
  font-weight: 600;
}

.metric-heading-wrap {
  position: relative;
}

.metrics-page .metrics-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 38px;
  column-gap: 12px;
}

.metrics-page .metrics-panel-head .metric-heading-wrap {
  align-self: center;
}

.metric-heading-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
}

.metric-heading-row h2 {
  margin: 0;
}

.info-icon-button {
  width: 22px;
  height: 22px;
  border: 1px solid #9fb3c8;
  border-radius: 50%;
  background: #fff;
  color: #334e68;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.info-icon-button:hover,
.info-icon-button[aria-expanded="true"] {
  background: #eef4ff;
  border-color: #0b63ce;
  color: #0b4fd6;
}

.metric-info-popover {
  position: absolute;
  top: 30px;
  left: 0;
  z-index: 20;
  width: min(560px, calc(100vw - 48px));
  padding: 10px 12px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 42, 67, 0.14);
  color: #52606d;
  font-size: 13px;
  line-height: 1.45;
}

.metric-tabs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.metrics-page .metrics-panel-head .metric-tabs {
  align-self: center;
  justify-self: end;
  height: 32px;
  margin: 0;
}

.metric-tabs button {
  border: 1px solid #d9e2ec;
  border-radius: 999px;
  background: #fff;
  color: #334e68;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  min-height: 30px;
  padding: 0 12px;
  line-height: 1;
  cursor: pointer;
}

.metric-tabs button.active {
  background: #0b63ce;
  border-color: #0b63ce;
  color: #fff;
}

.metrics-page #metricsTable {
  min-width: 840px;
  table-layout: fixed;
}

.metrics-page #metricsTable th,
.metrics-page #metricsTable td {
  padding: 8px 7px;
}

.metrics-page #metricsTable th:nth-child(1),
.metrics-page #metricsTable td:nth-child(1) { width: 19%; }
.metrics-page #metricsTable th:nth-child(2),
.metrics-page #metricsTable td:nth-child(2) { width: 6%; }
.metrics-page #metricsTable th:nth-child(3),
.metrics-page #metricsTable td:nth-child(3) { width: 15%; }
.metrics-page #metricsTable th:nth-child(4),
.metrics-page #metricsTable td:nth-child(4) { width: 8%; }
.metrics-page #metricsTable th:nth-child(5),
.metrics-page #metricsTable td:nth-child(5) { width: 12%; }
.metrics-page #metricsTable th:nth-child(6),
.metrics-page #metricsTable td:nth-child(6) { width: 14%; }
.metrics-page #metricsTable th:nth-child(7),
.metrics-page #metricsTable td:nth-child(7) { width: 12%; }
.metrics-page #metricsTable th:nth-child(8),
.metrics-page #metricsTable td:nth-child(8) { width: 14%; }
}

.metric-row {
  cursor: pointer;
}

.metric-row:hover td,
.metric-row.is-open td {
  background: #f8fafc;
}

.metric-period {
  font-weight: 700;
}

.metric-status {
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2f7;
  color: #486581;
  font-size: 11px;
  font-weight: 700;
}

.metric-detail-row td {
  padding: 0;
  background: #fbfcfe;
}

.metric-detail-layout {
  padding: 10px;
}

.metric-detail-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  align-items: stretch;
  gap: 10px;
  margin-bottom: 10px;
}

.metric-sets-card {
  max-width: 920px;
}

.metric-detail-card {
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
  padding: 10px;
  white-space: normal;
}

.metric-detail-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #243b53;
  text-align: center;
}

.metric-kv,
.metric-set-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 3px 0;
  color: #486581;
}

.metric-kv strong,
.metric-set-line strong {
  color: #17212b;
  text-align: right;
}

.metric-kv span,
.metric-set-line span {
  text-align: left;
}

.metric-set-callout {
  display: grid;
  gap: 3px;
  padding: 6px 0;
  color: #486581;
}

.metric-set-callout strong {
  color: #17212b;
}

.metric-set-callout em {
  font-style: normal;
  font-weight: 700;
}

.metric-set-line {
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.7fr) auto;
  border-top: 1px solid #eef2f7;
}

.metric-set-line:first-of-type {
  border-top: 0;
}

.metric-set-line small {
  color: #829ab1;
  text-align: left;
}

.metric-empty-line {
  color: #829ab1;
  padding: 3px 0;
}

.metric-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.metric-tags span {
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef2f7;
  color: #486581;
  font-size: 12px;
}

.muted-cell {
  color: #6b7c8f;
}

.monitoring-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.monitoring-defaults-wrap {
  border: 1px solid #e4e7eb;
  border-radius: 6px;
}

.monitoring-defaults-table {
  min-width: 1160px;
}

.monitoring-defaults-table th,
.monitoring-defaults-table td {
  padding: 5px 9px;
  text-align: center;
  vertical-align: middle;
}

.monitoring-defaults-table th.left,
.monitoring-defaults-table td.left,
.monitoring-defaults-name {
  text-align: left;
}

.monitoring-defaults-table input[type="time"] {
  width: 112px;
}

.monitoring-defaults-table input[type="number"] {
  width: 78px;
}

.monitoring-defaults-table select {
  width: 118px;
}

.monitoring-defaults-table input,
.monitoring-defaults-table select,
.monitoring-defaults-table button {
  height: 32px;
}

.monitoring-defaults-actions {
  white-space: nowrap;
}

.monitoring-defaults-actions .rules-save-state {
  margin-left: 8px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.add-underlying-form {
  margin-bottom: 12px;
}

.lookup-wide {
  min-width: min(720px, 100%);
}

.lookup-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.lookup-row input {
  min-width: 260px;
  flex: 1 1 280px;
}

.add-underlying-form .table-wrap {
  width: 100%;
}

.add-underlying-form #instrumentResultsTable {
  min-width: 760px;
}

.add-underlying-form input {
  min-width: 120px;
}

.inline-form .toggle {
  margin-top: 0;
}

.rules-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: auto;
}

.rules-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: end;
}

.rules-check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  color: #334e68;
  white-space: nowrap;
  flex: 0 0 auto;
}

.rules-check input {
  margin: 0;
}

.rules-field {
  min-width: 0;
  flex: 0 0 auto;
  min-height: 54px;
  justify-content: space-between;
}

.rules-field-disabled {
  opacity: 0.6;
}

.rules-field input[type="time"] {
  width: 108px;
}

.rules-field input[type="number"] {
  width: 86px;
}

.rules-field select {
  width: 118px;
}

.rules-field input,
.rules-field select,
.rules-save-wrap button {
  height: 38px;
}

.rules-save-wrap {
  display: inline-flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 54px;
  flex: 0 0 auto;
  margin-left: 8px;
}

.rules-save-state {
  color: #045d56;
  font-size: 13px;
  min-width: 42px;
}

.rules-text {
  color: #52606d;
  font-size: 13px;
}

.controls,
.ticket-controls,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.ticket-controls {
  row-gap: 10px;
}

.ticket-controls label {
  justify-content: flex-end;
}

.ticket-controls input,
.ticket-controls select,
.sound-preview-btn {
  height: 36px;
}

#maxAttemptsInput,
#waitSecondsInput {
  width: 88px;
}

#entrySoundSelect {
  width: 118px;
}

.set-name-field {
  min-width: 260px;
}

.ticket-status {
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  font-size: 13px;
  color: #334e68;
  background: #f8fafc;
}

.ticket-margin {
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  color: #243b53;
  background: #f8fafc;
}

.ticket-margin strong {
  color: #102a43;
}

.ticket-margin.status-error {
  color: #9b1c1c;
  border-color: #f1b5b5;
  background: #fff5f5;
}

.ticket-status.status-error {
  color: #9b1c1c;
  border-color: #f1b5b5;
  background: #fff5f5;
}

.ticket-status.status-ok {
  color: #045d56;
  border-color: #b8e6df;
  background: #f0fffb;
}

.ticket-status.status-warning {
  color: #8a4b00;
  border-color: #f5c16c;
  background: #fff8e6;
}

.ticket-controls button {
  align-self: end;
}

.sound-preview-btn {
  min-width: 64px;
}

.suggestions-panel .panel-head-row {
  align-items: center;
}

.suggestions-wrap {
  margin-top: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

#suggestionsTable {
  min-width: 980px;
  white-space: nowrap;
}

#suggestionsTable th,
#suggestionsTable td {
  padding-top: 7px;
  padding-bottom: 7px;
}

.suggestion-main-row {
  cursor: pointer;
}

.suggestion-main-row:hover td,
.suggestion-main-row.is-open td {
  background: #f8fafc;
}

.suggestion-detail-cell {
  background: #f8fafc;
  border-top: 0;
  text-align: left;
}

.suggestion-detail {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: 980px;
  padding: 4px 8px 7px;
  color: #334e68;
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
}

.suggestion-more-row td {
  text-align: center;
  background: #f8fafc;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #334e68;
}

input,
select,
button {
  border: 1px solid #bcccdc;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
}

button {
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease, opacity 120ms ease;
}

button.primary {
  background: #0b69ff;
  border-color: #0b69ff;
  color: #fff;
}

button.is-pressed {
  transform: translateY(1px) scale(0.98);
  box-shadow: inset 0 2px 4px rgba(16, 42, 67, 0.18);
}

button.is-working {
  cursor: wait;
  opacity: 0.72;
}

button.primary.is-pressed {
  background: #075edb;
}

.subtle-btn {
  padding: 4px 10px;
  color: #486581;
  background: #f8fafc;
}

.buy-btn {
  color: #045d56;
}

.sell-btn {
  color: #9b1c1c;
}

.buy-btn.is-selected {
  background: #e6f7ee;
  border-color: #8ed0ab;
  color: #045d56;
  font-weight: 600;
}

.sell-btn.is-selected {
  background: #fdecec;
  border-color: #f2b2b2;
  color: #9b1c1c;
  font-weight: 600;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #e4e7eb;
  border-radius: 6px;
}

.set-summary-row {
  cursor: pointer;
}

.set-summary-row:hover td {
  background: #f8fafc;
}

.set-summary-row.is-open td {
  background: #f8fafc;
}

.set-summary-name {
  font-weight: 600;
}

.set-summary-row td {
  vertical-align: middle;
}

.active-set-name-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  line-height: 1.15;
  max-width: 100%;
}

.active-set-logo-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  min-height: 22px;
  border-radius: 999px;
  background: #eef2f7;
  color: #52606d;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
}

.active-set-logo-slot.is-loaded {
  background: transparent;
}

.active-set-logo {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  object-fit: contain;
  display: block;
}

.active-set-name-text {
  min-width: 0;
}

.set-summary-lots {
  text-align: center;
}

.lot-imbalance-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  background: #fff3bf;
  color: #7c5e10;
  font-weight: 700;
  line-height: 1;
}

.set-detail-row td {
  background: #fbfcfe;
  padding: 0;
}

.set-detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(300px, 1fr) minmax(380px, 1.22fr);
  align-items: flex-start;
  gap: 10px;
  margin: 8px 12px;
  max-width: 100%;
}

.set-detail-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.set-detail-wrap {
  padding: 4px 10px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
  width: 100%;
  max-width: 100%;
}

.set-detail-side {
  display: flex;
  flex: 0 1 340px;
  min-width: 260px;
  max-width: 380px;
  flex-direction: column;
  gap: 8px;
}

.set-detail-item {
  padding: 4px 0;
}

.set-detail-item + .set-detail-item {
  border-top: 1px solid #eef2f6;
}

.set-detail-line {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  max-width: 100%;
  flex-wrap: wrap;
}

.set-detail-leg {
  font-size: 11px;
  color: #334e68;
  line-height: 1.25;
}

.set-detail-lots {
  font-size: 11px;
  color: #829ab1;
  line-height: 1.25;
}

.set-detail-lots-closed {
  color: #9f1239;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 999px;
  padding: 1px 6px;
}

.set-detail-pnl {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
}

.set-detail-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 10px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
  white-space: normal;
  width: 100%;
  min-width: 0;
}

.set-detail-rules-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 600;
  color: #486581;
}

.set-detail-rules-text {
  font-size: 11px;
  color: #334e68;
  line-height: 1.35;
  width: 100%;
  padding-bottom: 2px;
}

.set-detail-rule-line + .set-detail-rule-line {
  margin-top: 3px;
}

.dashboard-rules-form {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding-top: 4px;
  overflow: visible;
}

.dashboard-rules-form .rules-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-end;
  align-content: flex-start;
  padding: 6px;
  border: 1px solid #e4ebf3;
  border-radius: 6px;
  background: #f8fafc;
  min-width: 0;
}

.dashboard-rules-form .rules-check {
  min-height: 0;
  flex: 1 0 100%;
  padding-bottom: 2px;
  color: #243b53;
  font-weight: 600;
  border-bottom: 1px solid #e9eef5;
}

.dashboard-rules-form .rules-field {
  flex: 1 1 68px;
  font-size: 10px;
  color: #627d98;
}

.dashboard-rules-form .rules-field input,
.dashboard-rules-form .rules-field select {
  width: 100%;
  min-height: 28px;
  padding: 4px 6px;
  font-size: 11px;
}

.dashboard-rules-form .rules-save-wrap {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-left: 0;
}

.dashboard-rules-form .rules-save-wrap .primary {
  padding: 6px 10px;
  font-size: 11px;
}

.set-detail-exit {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  padding: 6px 10px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
  width: 100%;
}

.danger-inline {
  color: #9b1c1c;
  border-color: #f2c1c1;
  padding: 5px 9px;
  font-size: 11px;
  line-height: 1.2;
}

.danger-inline:disabled {
  cursor: wait;
  opacity: 0.68;
}

.set-payoff-panel {
  flex: 1 1 460px;
  min-width: 360px;
  max-width: 700px;
  padding: 8px 10px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #fff;
}

.set-payoff-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: #334e68;
}

.set-payoff-head strong {
  font-size: 12px;
}

.set-payoff-head span {
  color: #829ab1;
  font-size: 11px;
}

.set-payoff-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.set-payoff-metrics div {
  border: 1px solid #eef2f6;
  border-radius: 5px;
  padding: 5px 6px;
  background: #fbfcfe;
}

.set-payoff-metrics span,
.set-payoff-metrics strong {
  display: block;
  font-size: 10px;
  line-height: 1.25;
}

.set-payoff-metrics span {
  color: #829ab1;
}

.set-payoff-chart-wrap {
  overflow: hidden;
}

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

.payoff-zero {
  stroke: #9fb3c8;
  stroke-width: 1;
}

.payoff-strike {
  stroke: #bcccdc;
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.payoff-breakeven {
  stroke: #f0b429;
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.payoff-current {
  stroke: #486581;
  stroke-width: 1.4;
}

.payoff-line {
  fill: none;
  stroke: #0b69ff;
  stroke-width: 2.4;
}

.payoff-label,
.payoff-ylabel,
.payoff-current-label {
  fill: #627d98;
  font-size: 10px;
}

.payoff-current-label {
  font-weight: 700;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
}

.history-day-row {
  cursor: pointer;
}

.history-day-row:hover td,
.history-day-row.is-open td {
  background: #f8fafc;
}

.history-day-name {
  font-weight: 600;
}

.history-day-detail-row td {
  background: #fbfcfe;
  padding: 0;
}

.history-day-detail {
  margin: 8px 12px;
  overflow: auto;
}

.history-detail-table {
  min-width: 900px;
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  overflow: hidden;
}

.history-detail-table th,
.history-detail-table td {
  font-size: 11px;
  padding: 6px 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid #e4e7eb;
  text-align: right;
  white-space: nowrap;
  font-size: 13px;
}

td.left,
th.left {
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #486581;
  z-index: 1;
}

#setsTable th,
#historyTable th,
#unassignedTable th {
  text-align: center;
}

.lots-head {
  text-align: center;
}

.lots-input {
  width: 44px;
  min-width: 44px;
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
}

td:first-child,
td:nth-child(2),
th:first-child,
th:nth-child(2) {
  text-align: center;
}

#setsTable td.left,
#historyTable td.left,
#unassignedTable td.left,
#setsTable td:first-child,
#historyTable td:first-child,
#unassignedTable td:first-child,
#setsTable td:nth-child(2) {
  text-align: left;
}

.dashboard-page #setsTable {
  table-layout: auto;
}

.dashboard-page #historyTable {
  min-width: 420px;
}

.dashboard-page #historyTable th:first-child,
.dashboard-page #historyTable td:first-child {
  text-align: left;
}

.dashboard-page #historyTable th:nth-child(2),
.dashboard-page #historyTable td:nth-child(2),
.dashboard-page #historyTable th:nth-child(3),
.dashboard-page #historyTable td:nth-child(3) {
  text-align: right;
}

.dashboard-page #setsTable th:nth-child(1),
.dashboard-page #setsTable td:nth-child(1),
.dashboard-page #setsTable th:nth-child(2),
.dashboard-page #setsTable td:nth-child(2) {
  text-align: left;
}

.dashboard-page #setsTable th:nth-child(3),
.dashboard-page #setsTable td:nth-child(3),
.dashboard-page #setsTable th:nth-child(4),
.dashboard-page #setsTable td:nth-child(4),
.dashboard-page #setsTable th:nth-child(5),
.dashboard-page #setsTable td:nth-child(5),
.dashboard-page #setsTable th:nth-child(6),
.dashboard-page #setsTable td:nth-child(6) {
  text-align: right;
}

.dashboard-page #setsTable th:nth-child(4),
.dashboard-page #setsTable td:nth-child(4) {
  text-align: center;
}

.strike-cell {
  font-weight: 600;
  text-align: center;
}

.atm-row td {
  background: #eef4ff;
}

.atm-row .strike-cell {
  background: #dbeafe;
  color: #0b4fd6;
}

.ticket-wrap table {
  min-width: 100%;
}

.toggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
}

.account-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.danger-btn {
  color: #9b1c1c;
}

.rowActions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.grabHandle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  color: #829ab1;
  cursor: grab;
  user-select: none;
  font-weight: 700;
  letter-spacing: 1px;
}

.grabHandle:active {
  cursor: grabbing;
}

.underlyingDivider td {
  border-top: 8px solid #f5f7fa;
}

.sideBadge {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-weight: 700;
  color: #fff;
  font-size: 0.85rem;
}

.badgeBuy {
  background: #4a9f2b;
}

.badgeSell {
  background: #df4b53;
}

.pnlPos {
  color: #4a9f2b;
  font-weight: 600;
}

.pnlNeg {
  color: #df4b53;
  font-weight: 600;
}

.action-review-strip[hidden] {
  display: none;
}

.reconciliation-strip[hidden] {
  display: none;
}

.reconciliation-row.action td:first-child {
  color: #b42318;
  font-weight: 800;
}

.reconciliation-row.warning td:first-child {
  color: #b7791f;
  font-weight: 800;
}

.action-review-panel {
  background: #fff;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 10px 12px;
}

.action-review-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.action-review-head strong {
  font-size: 15px;
  margin-right: 8px;
}

.action-review-head span {
  color: #627d98;
  font-size: 12px;
  font-weight: 700;
}

.action-review-more {
  color: #627d98;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 4px;
}

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

.action-review-item {
  background: #f8fafc;
  border: 1px solid #d9e2ec;
  border-left: 4px solid #486581;
  border-radius: 6px;
}

.action-review-item.ok {
  border-left-color: #4a9f2b;
}

.action-review-item.warning {
  border-left-color: #f59e0b;
}

.action-review-item.error {
  border-left-color: #df4b53;
}

.action-review-item summary {
  align-items: center;
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  list-style: none;
  padding: 8px 9px;
}

.action-review-item summary::-webkit-details-marker {
  display: none;
}

.action-review-item [data-mark-seen] {
  background: #0b69ff;
  border-color: #0b69ff;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  min-height: 28px;
  padding: 4px 12px;
}

.action-review-item [data-mark-seen]:hover {
  background: #075edb;
  border-color: #075edb;
}

.action-review-item [data-mark-seen]:disabled {
  opacity: 0.72;
}

.action-review-time,
.action-review-main small,
.action-review-main em {
  color: #627d98;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.action-review-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.action-review-main strong {
  font-size: 13px;
  white-space: normal;
}

.action-review-item pre {
  background: #fff;
  border-top: 1px solid #d9e2ec;
  color: #486581;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  margin: 0;
  max-height: 220px;
  min-height: auto;
  overflow-x: auto;
  padding: 8px 9px;
  white-space: pre-wrap;
}

pre {
  margin: 0;
  padding: 12px;
  min-height: 200px;
  max-height: 420px;
  overflow: auto;
  background: #0f172a;
  color: #d9e2ec;
  border-radius: 6px;
  font-size: 12px;
}

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .info-grid {
    gap: 10px;
  }

  .info-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .info-card-head h2 {
    flex: none;
  }

  .info-inline-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
}

@media (max-width: 900px) {
  .auto-entry-panel {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .emergency-panel {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

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

  .metrics-page #metricsTable {
    min-width: 720px;
  }

  .metrics-page #metricsTable th,
  .metrics-page #metricsTable td {
    padding: 7px 5px;
    font-size: 11px;
  }

  .metrics-page #metricsTable th:nth-child(1),
  .metrics-page #metricsTable td:nth-child(1) { width: 18%; }
  .metrics-page #metricsTable th:nth-child(2),
  .metrics-page #metricsTable td:nth-child(2) { width: 6%; }
  .metrics-page #metricsTable th:nth-child(3),
  .metrics-page #metricsTable td:nth-child(3) { width: 15%; }
  .metrics-page #metricsTable th:nth-child(4),
  .metrics-page #metricsTable td:nth-child(4) { width: 8%; }
  .metrics-page #metricsTable th:nth-child(5),
  .metrics-page #metricsTable td:nth-child(5) { width: 12%; }
  .metrics-page #metricsTable th:nth-child(6),
  .metrics-page #metricsTable td:nth-child(6) { width: 14%; }
  .metrics-page #metricsTable th:nth-child(7),
  .metrics-page #metricsTable td:nth-child(7) { width: 12%; }
  .metrics-page #metricsTable th:nth-child(8),
  .metrics-page #metricsTable td:nth-child(8) { width: 15%; }

  .metric-detail-summary-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .auto-entry-budget {
    justify-content: flex-start;
  }

  .auto-entry-action {
    justify-self: flex-start;
  }

  .emergency-actions {
    justify-content: flex-start;
  }

  .config-row {
    grid-template-columns: minmax(180px, 1fr) 160px;
  }

  .config-help {
    grid-column: 1 / -1;
  }

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

  .info-controls label {
    flex-direction: column;
    align-items: flex-start;
  }

  .risk-source {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 12px;
  }

  .metrics-page .metrics-panel-head {
    grid-template-columns: 1fr;
    row-gap: 6px;
  }

  .metrics-page .metric-heading-row {
    gap: 6px;
    min-height: 24px;
  }

  .metrics-page .metric-heading-row h2 {
    font-size: 18px;
  }

  .metrics-page .info-icon-button {
    width: 18px;
    height: 18px;
    font-size: 11px;
  }

  .metrics-page .metrics-panel-head .metric-tabs {
    justify-self: start;
    height: 28px;
  }

  .metrics-page .metric-tabs {
    gap: 6px;
  }

  .metrics-page .metric-tabs button {
    height: 26px;
    min-height: 26px;
    padding: 0 10px;
    font-size: 12px;
  }

  .metrics-page #metricsTable.is-compact-metrics {
    min-width: 0;
    width: 100%;
  }

  .metrics-page #metricsTable.is-compact-metrics th,
  .metrics-page #metricsTable.is-compact-metrics td {
    white-space: nowrap;
  }

  .metrics-page #metricsTable.is-compact-metrics th:first-child,
  .metrics-page #metricsTable.is-compact-metrics td:first-child {
    width: 40%;
    padding-left: 5px;
    padding-right: 5px;
    text-align: left;
  }

  .metrics-page #metricsTable.is-compact-metrics[data-period="daily"] th:first-child,
  .metrics-page #metricsTable.is-compact-metrics[data-period="daily"] td:first-child,
  .metrics-page #metricsTable.is-compact-metrics[data-period="monthly"] th:first-child,
  .metrics-page #metricsTable.is-compact-metrics[data-period="monthly"] td:first-child {
    padding-left: 8px;
  }

  .metrics-page #metricsTable.is-compact-metrics th:nth-child(2),
  .metrics-page #metricsTable.is-compact-metrics td:nth-child(2) {
    width: 32%;
    text-align: right;
  }

  .metrics-page #metricsTable.is-compact-metrics th:nth-child(3),
  .metrics-page #metricsTable.is-compact-metrics td:nth-child(3) {
    width: 28%;
    text-align: right;
  }

  .config-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

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

  .metrics-summary .summary-card {
    padding: 8px 10px;
  }

  .metrics-summary .summary-card-label {
    font-size: 11px;
    margin-bottom: 4px;
  }

  .metrics-summary .summary-card-value {
    font-size: 15px;
  }

  .metric-detail-summary-grid {
    grid-template-columns: 1fr;
  }

  .metric-set-line {
    grid-template-columns: minmax(130px, 1fr) auto;
  }

  .metric-set-line small {
    display: none;
  }

  .config-savebar {
    padding-bottom: 8px;
  }

  .topbar,
  .band {
    margin-bottom: 12px;
  }

  .dashboard-page .summary-grid {
    grid-template-columns: repeat(var(--summary-cols, 4), minmax(0, 1fr));
    gap: 6px;
  }

  .dashboard-page .summary-card {
    padding: 8px 6px;
  }

  .dashboard-page .summary-card-label {
    font-size: 10px;
    margin-bottom: 4px;
    line-height: 1.1;
  }

  .dashboard-page .summary-card-value {
    font-size: 13px;
    line-height: 1.1;
  }

  .dashboard-page #setsTable,
  .dashboard-page #historyTable,
  .dashboard-page #unassignedTable {
    min-width: 100%;
    table-layout: fixed;
    width: 100%;
  }

  .dashboard-page .table-wrap {
    overflow-x: hidden;
  }

  .dashboard-page #setsTable th,
  .dashboard-page #setsTable td,
  .dashboard-page #historyTable th,
  .dashboard-page #historyTable td,
  .dashboard-page #unassignedTable th,
  .dashboard-page #unassignedTable td,
  .dashboard-page #reconciliationTable th,
  .dashboard-page #reconciliationTable td {
    padding: 7px 6px;
    font-size: 11px;
  }

  .dashboard-page .active-set-name-line {
    gap: 5px;
  }

  .dashboard-page .active-set-logo-slot,
  .dashboard-page .active-set-logo {
    flex-basis: 18px;
    width: 18px;
    height: 18px;
    min-height: 18px;
  }

  .dashboard-page .active-set-logo-slot {
    font-size: 7px;
  }

  .dashboard-page #setsTable th:first-child,
  .dashboard-page #setsTable td:first-child,
  .dashboard-page #historyTable th:first-child,
  .dashboard-page #historyTable td:first-child,
  .dashboard-page #unassignedTable th:first-child,
  .dashboard-page #unassignedTable td:first-child {
    text-align: left;
    padding-left: 10px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.2;
  }

  .dashboard-page #setsTable th:nth-child(6),
  .dashboard-page #setsTable td:nth-child(6),
  .dashboard-page #unassignedTable th:nth-child(4),
  .dashboard-page #unassignedTable td:nth-child(4) {
    text-align: right;
    padding-right: 10px;
    white-space: nowrap;
    width: 84px;
  }

  .dashboard-page #setsTable th:nth-child(2),
  .dashboard-page #setsTable td:nth-child(2),
  .dashboard-page #setsTable th:nth-child(3),
  .dashboard-page #setsTable td:nth-child(3),
  .dashboard-page #setsTable th:nth-child(4),
  .dashboard-page #setsTable td:nth-child(4),
  .dashboard-page #setsTable th:nth-child(5),
  .dashboard-page #setsTable td:nth-child(5) {
    display: none;
  }

  .dashboard-page #setsTable th:first-child,
  .dashboard-page #setsTable td:first-child {
    width: auto;
  }

  .dashboard-page #unassignedTable th:nth-child(2),
  .dashboard-page #unassignedTable td:nth-child(2),
  .dashboard-page #unassignedTable th:nth-child(3),
  .dashboard-page #unassignedTable td:nth-child(3) {
    display: none;
  }

  .dashboard-page .set-detail-wrap {
    padding: 3px 8px;
    width: auto;
    max-width: 100%;
  }

  .action-review-panel {
    padding: 9px 10px;
  }

  .action-review-item summary {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    gap: 6px;
    padding: 7px;
  }

  .action-review-time,
  .action-review-main small,
  .action-review-main em,
  .action-review-more {
    font-size: 10px;
  }

  .action-review-main strong {
    font-size: 11px;
  }

  .dashboard-page .set-detail-grid {
    grid-template-columns: 1fr;
    gap: 6px;
    margin: 6px 8px 0;
    max-width: calc(100vw - 48px);
  }

  .dashboard-page #setsTable .set-detail-row > td {
    padding-top: 0;
    padding-bottom: 0;
  }

  .dashboard-page .set-detail-left {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    gap: 6px;
  }

  .dashboard-page .dashboard-rules-form {
    grid-template-columns: 1fr;
  }

  .dashboard-page .set-detail-item {
    padding: 3px 0;
  }

  .dashboard-page .set-detail-line {
    gap: 12px;
  }

  .dashboard-page .set-detail-line .sideBadge {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    font-size: 0.68rem;
  }

  .dashboard-page .set-detail-leg,
  .dashboard-page .set-detail-lots,
  .dashboard-page .set-detail-pnl,
  .dashboard-page .set-detail-rules-label,
  .dashboard-page .set-detail-rules-text {
    font-size: 10px;
  }

  .dashboard-page .set-detail-rules {
    gap: 4px;
    padding: 5px 8px;
    max-width: 100%;
  }

  .dashboard-page .set-detail-exit {
    gap: 5px;
    padding: 5px 8px;
    max-width: 100%;
  }

  .dashboard-page .danger-inline {
    font-size: 10px;
    padding: 5px 8px;
  }

  .dashboard-page .set-payoff-panel {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 6px 8px;
  }

  .dashboard-page .set-payoff-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .dashboard-page .set-payoff-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .dashboard-page .set-payoff-metrics div {
    padding: 4px;
  }

  .dashboard-page .set-payoff-metrics span,
  .dashboard-page .set-payoff-metrics strong,
  .dashboard-page .set-payoff-head span,
  .dashboard-page .payoff-label,
  .dashboard-page .payoff-ylabel,
  .dashboard-page .payoff-current-label {
    font-size: 9px;
  }

  .dashboard-page #historyTable th:nth-child(2),
  .dashboard-page #historyTable td:nth-child(2),
  .dashboard-page #historyTable th:nth-child(3),
  .dashboard-page #historyTable td:nth-child(3) {
    text-align: right;
    padding-right: 10px;
  }

  .dashboard-page .history-day-detail {
    margin: 6px 8px;
  }

  .dashboard-page .history-detail-table {
    min-width: 100%;
    table-layout: fixed;
  }

  .dashboard-page .history-detail-table th,
  .dashboard-page .history-detail-table td {
    font-size: 10px;
    padding: 6px;
  }

  .dashboard-page .history-detail-table th:nth-child(2),
  .dashboard-page .history-detail-table td:nth-child(2),
  .dashboard-page .history-detail-table th:nth-child(4),
  .dashboard-page .history-detail-table td:nth-child(4),
  .dashboard-page .history-detail-table th:nth-child(6),
  .dashboard-page .history-detail-table td:nth-child(6),
  .dashboard-page .history-detail-table th:nth-child(7),
  .dashboard-page .history-detail-table td:nth-child(7) {
    display: none;
  }

}

@media (max-width: 640px) and (orientation: landscape) {
  .dashboard-page .set-payoff-panel {
    display: block;
  }
}
