@font-face {
  font-family: "Didot";
  src: local("Didot");
  font-weight: 400;
  font-style: normal;
}

:root {
  color-scheme: dark;
  --bg: #111111;
  --panel: #212121;
  --panel-raised: #2a2a2a;
  --border: #3f3f3f;
  --text: #e1dede;
  --muted: #8a8a8a;
  --online: #04bd19;
  --stale: #e08a00;
  --offline: #f51000;
  --profit: #04bd19;
  --loss: #f51000;
}

* { box-sizing: border-box; }

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 300;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

a:hover { color: #ffffffab; }

header {
  padding: 1.25rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-family: "Didot", serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  color: rgba(147, 147, 147, 0.92);
}

h1 a {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  color: inherit;
  text-decoration: none;
}

h1 .title-brand {
  font-size: 2.5rem;
  font-weight: 300;
  letter-spacing: 0.08em;
}

h1 .title-live {
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  margin-top: 0.1rem;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta { color: var(--muted); font-size: 0.8rem; font-weight: 300; }

.header-summary {
  margin-top: 0.65rem;
}

.header-timestamp {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 300;
  margin-bottom: 0.85rem;
}

.header-counters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.counter-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  cursor: pointer;
  border-radius: 4px;
}

.counter-btn:hover .counter-label {
  color: #ffffff;
}

.counter-btn.active .counter-label {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.counter-online .counter-num { color: var(--online); }
.counter-offline .counter-num { color: var(--offline); }
.counter-total .counter-num { color: var(--text); }
.counter-replay .counter-num { color: #d4a017; }
.counter-label { color: var(--text); }
.counter-sep {
  color: var(--muted);
  margin: 0 0.2rem;
}

.freshness-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--panel-raised);
  white-space: nowrap;
}

.freshness-banner-compact {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
}

.freshness-banner.freshness-online {
  color: var(--online);
  border-color: rgba(4, 189, 25, 0.35);
  background: rgba(4, 189, 25, 0.08);
}

.freshness-banner.freshness-offline {
  color: var(--offline);
  border-color: rgba(245, 16, 0, 0.35);
  background: rgba(245, 16, 0, 0.08);
}

.freshness-banner.freshness-stale {
  color: var(--stale);
  border-color: rgba(224, 138, 0, 0.35);
  background: rgba(224, 138, 0, 0.08);
}

.freshness-banner-block {
  margin-bottom: 1rem;
}

main {
  flex: 1 0 auto;
  padding: 1.25rem;
}

button, .btn {
  background: var(--panel-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.58rem;
  font-weight: 300;
  cursor: pointer;
  font-size: 0.72rem;
}

button:hover, .btn:hover {
  background: #404040;
  color: #ffffff;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

#refreshBtn.is-refreshing .refresh-icon {
  display: inline-block;
  animation: refresh-spin 0.75s linear infinite;
}

#refreshBtn .refresh-icon {
  margin-right: 0.35em;
}

#alertsToggle + #refreshBtn {
  margin-left: 2.5rem;
}

body.is-manual-refresh main {
  opacity: 0.72;
  transition: opacity 0.15s ease;
}

@keyframes refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.header-timestamp.refresh-pulse,
.meta.refresh-pulse {
  animation: refresh-highlight 0.65s ease;
}

@keyframes refresh-highlight {
  0%, 100% { opacity: 1; }
  40% { opacity: 0.55; color: var(--online); }
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.online {
  color: var(--online);
  background: rgba(4, 189, 25, 0.1);
  border: 1px solid rgba(4, 189, 25, 0.35);
}

.badge.stale {
  color: var(--stale);
  background: rgba(224, 138, 0, 0.1);
  border: 1px solid rgba(224, 138, 0, 0.35);
}

.badge.offline {
  color: var(--offline);
  background: rgba(245, 16, 0, 0.1);
  border: 1px solid rgba(245, 16, 0, 0.35);
}

.badge.trade-open {
  color: #e6a020;
  background: rgba(255, 165, 0, 0.1);
  border: 1px solid rgba(255, 165, 0, 0.35);
}

.badge-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.strategy-card-status .badge-group {
  justify-content: flex-end;
}

.pnl-positive { color: var(--profit); font-weight: 400; }
.pnl-negative { color: var(--loss); font-weight: 400; }
.pnl-flat { color: var(--text); }

.error { color: var(--offline); margin-bottom: 1rem; }
.empty { color: var(--muted); padding: 2rem 0; text-align: center; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  font-weight: 300;
  line-height: 1.35;
}

thead th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(63, 63, 63, 0.55);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: rgba(42, 42, 42, 0.65); }

.strategy-link {
  font-weight: 400;
  color: #f0f0ee;
}

.open-link {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 300;
}

.open-link:hover { color: #ffffff; }

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 300;
}

.back-link:hover { color: #ffffff; }

.page-title {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.metric {
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
}

.metric-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.metric-value {
  font-size: 0.95rem;
  font-weight: 400;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem 2rem;
  font-size: 0.8rem;
  font-weight: 300;
  line-height: 1.5;
}

.statistics-section > h2 {
  margin-bottom: 1.1rem;
}

.stats-column {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.stat-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.stat-line-gap-after {
  margin-bottom: 0.6rem;
}

.stat-label {
  color: var(--muted);
  font-weight: 300;
}

.stat-value {
  color: var(--text);
  font-weight: 300;
}

.stat-value.stat-profit {
  color: var(--profit);
}

.stat-value.stat-loss {
  color: var(--loss);
}

.stat-value.stat-neutral {
  color: var(--text);
}

.stat-line-multiline {
  align-items: flex-start;
}

.stat-value.stat-multiline {
  white-space: pre-line;
  display: inline-block;
  text-align: left;
  line-height: 1.45;
}

.timeline-panel {
  margin-top: 0.75rem;
  overflow-x: auto;
}

.timeline-cap-note {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 300;
}

.timeline-table {
  width: 100%;
  min-width: 38rem;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.8rem;
  font-weight: 300;
}

.timeline-col-time { width: 6.25rem; }
.timeline-col-trade { width: 6.25rem; }
.timeline-col-action { width: 5.25rem; }
.timeline-col-details { width: auto; }
.timeline-col-pnl { width: 5.5rem; }

.timeline-table td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  vertical-align: baseline;
  border-bottom: 1px solid rgba(63, 63, 63, 0.45);
}

.timeline-table tr:last-child td {
  border-bottom: none;
}

.timeline-date-row td {
  padding-top: 0.85rem;
  padding-bottom: 0.35rem;
  border-bottom: none;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 300;
}

.timeline-date-row:first-child td {
  padding-top: 0.15rem;
}

.timeline-time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline-trade {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}
.timeline-trade-run {
  margin-left: 0.05rem;
  color: var(--muted);
  font-size: 0.68em;
  font-weight: 300;
}
.timeline-action { color: var(--text); white-space: nowrap; overflow: hidden; }
.timeline-action-entry { color: var(--profit); }
.timeline-action-exit { color: var(--loss); }
.timeline-details { color: var(--text); }
.timeline-detail-meta { color: var(--muted); margin-left: 0.5rem; }
.timeline-pnl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-right: 0; }

.chart-wrap {
  width: 100%;
  overflow-x: auto;
}

.chart-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.chart-section-header h2 {
  margin: 0;
}

.chart-section .chart-toggle button {
  min-width: 3.25rem;
}

.chart-svg {
  width: 100%;
  min-width: 480px;
  height: 360px;
  display: block;
}

.chart-axis { stroke: var(--border); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--profit); stroke-width: 2; }
.chart-line.negative { stroke: var(--loss); }
.chart-zero { stroke: rgba(138, 138, 138, 0.45); stroke-width: 1; stroke-dasharray: 4 4; }

details.metadata {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

details.timeline-expander {
  margin-top: 0;
  padding-bottom: 1rem;
}

details.timeline-expander[open] {
  margin-bottom: 1.25rem;
}

details.timeline-expander[open] .timeline-panel {
  max-height: min(28rem, 55vh);
  overflow-y: auto;
}

details.metadata summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.03em;
}

details.detailed-stats-expander {
  margin-top: 0;
  margin-bottom: 1rem;
}

.detailed-stats-panel {
  padding-top: 0.85rem;
  padding-bottom: 0.35rem;
}

.detailed-stats-section + .detailed-stats-section {
  margin-top: 1.35rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}

.detailed-stats-section-title {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text);
  margin: 0 0 0.75rem;
}

.validation-headlines {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.35rem;
  margin-bottom: 0.85rem;
}

.validation-headline {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.validation-headline-label {
  color: var(--muted);
  font-size: 0.76rem;
}

.validation-badge,
.validation-coverage,
.validation-confidence {
  font-size: 0.76rem;
  font-weight: 400;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.validation-status-tracking,
.validation-status-in-tolerance {
  color: var(--online);
  border-color: rgba(4, 189, 25, 0.35);
  background: rgba(4, 189, 25, 0.08);
}

.validation-status-slight-deviation {
  color: #d4a017;
  border-color: rgba(212, 160, 23, 0.35);
  background: rgba(212, 160, 23, 0.08);
}

.validation-status-moderate-deviation {
  color: #e07a20;
  border-color: rgba(224, 122, 32, 0.35);
  background: rgba(224, 122, 32, 0.08);
}

.validation-status-early-divergence,
.validation-status-preliminary-divergence {
  color: #e07a20;
  border-color: rgba(224, 122, 32, 0.4);
  background: rgba(224, 122, 32, 0.1);
}

.validation-status-diverging {
  color: var(--loss);
  border-color: rgba(245, 16, 0, 0.35);
  background: rgba(245, 16, 0, 0.08);
}

.validation-coverage,
.validation-confidence {
  color: var(--text);
  background: var(--panel-raised);
}

.validation-note {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 300;
  line-height: 1.45;
  max-width: 52rem;
}

.validation-fields {
  margin-bottom: 0.95rem;
}

.validation-comparison-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1.85rem 0 0;
  padding-bottom: 1.35rem;
}

.validation-table-footnote {
  margin: 1.35rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 300;
  line-height: 1.45;
  max-width: 42rem;
  text-align: center;
}

.validation-comparison-table {
  width: max-content;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin: 0;
  table-layout: auto;
}

.validation-comparison-table th,
.validation-comparison-table td {
  padding: 0.5rem 1.05rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.validation-comparison-table thead th {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.72rem;
}

.validation-comparison-table tbody th {
  color: var(--muted);
  font-weight: 400;
  padding-right: 1.85rem;
}

.validation-col-live,
.validation-col-historical {
  color: var(--muted);
  font-weight: 400;
  padding-left: 1.05rem;
  padding-right: 1.05rem;
}

.validation-col-spacer {
  width: 3.25rem;
  min-width: 3.25rem;
  max-width: 3.25rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.validation-col-comparison {
  font-weight: 400;
  font-size: 0.82rem;
  padding-left: 0.95rem;
  padding-right: 1.05rem;
}

.validation-comparison-table tbody .validation-col-comparison {
  color: #b4b1b1;
}

.validation-comparison-table tbody tr:last-child th,
.validation-comparison-table tbody tr:last-child td {
  border-bottom: 1px solid var(--border);
}

.dev-baseline-warnings {
  border: 1px solid rgba(212, 160, 23, 0.45);
  background: rgba(212, 160, 23, 0.08);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  margin: 0.55rem 0;
}

.dev-baseline-warnings.compact {
  margin-top: 0.35rem;
}

.dev-baseline-warnings-title {
  color: #d4a017;
  font-size: 0.74rem;
  font-weight: 500;
  margin: 0 0 0.35rem;
}

.dev-baseline-warnings ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.dev-baseline-warnings li + li {
  margin-top: 0.25rem;
}

.dev-baseline-zone {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  background: var(--panel-raised);
}

.dev-baseline-zone h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 500;
  margin: 0 0 0.45rem;
}

.dev-only-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(212, 160, 23, 0.45);
  background: rgba(212, 160, 23, 0.1);
  color: #d4a017;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dev-baseline-filename {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.45;
}

.dev-baseline-filename code {
  font-size: 0.78rem;
  word-break: break-all;
}

.dev-baseline-filename-missing {
  color: var(--muted);
  font-size: 0.74rem;
}

.dev-baseline-meta {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
  margin: 0 0 0.65rem;
}

.dev-baseline-visibility {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.65rem 0 0.75rem;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.45;
  cursor: pointer;
}

.dev-baseline-visibility input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.dev-baseline-commission {
  flex-direction: column;
  gap: 0.35rem;
  cursor: default;
}

.dev-baseline-commission select {
  max-width: 22rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.74rem;
}

.dev-overview-url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin: 0.55rem 0 0.65rem;
}

.dev-overview-url-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.76rem;
}

.dev-overview-url-input:focus-visible {
  outline: none;
  border-color: var(--text);
}

.dev-overview-save-btn {
  flex: 0 0 auto;
}

.dev-status-note-input {
  width: 100%;
  margin: 0.65rem 0 0.85rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.45;
  resize: vertical;
}

.dev-status-note-input:focus-visible {
  outline: 2px solid rgba(225, 222, 222, 0.35);
  outline-offset: 1px;
}

.dev-status-note-colors {
  margin: 0 0 0.85rem;
  padding: 0;
  border: 0;
}

.dev-status-note-colors legend {
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dev-status-note-color-option {
  display: inline-flex;
  align-items: center;
  margin-right: 0.65rem;
  cursor: pointer;
}

.dev-status-note-color-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.dev-status-note-color-swatch {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
}

.dev-status-note-color-option input:checked + .dev-status-note-color-swatch {
  border-color: var(--text);
}

.dev-status-note-color-swatch-neutral {
  color: var(--text);
  background: var(--panel-raised);
}

.dev-status-note-color-swatch-green {
  color: var(--profit);
  background: rgba(4, 189, 25, 0.1);
}

.dev-status-note-color-swatch-blue {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.12);
}

.dev-status-note-color-swatch-orange {
  color: var(--stale);
  background: rgba(224, 138, 0, 0.1);
}

.dev-status-note-color-swatch-red {
  color: var(--loss);
  background: rgba(245, 16, 0, 0.1);
}

.dev-baseline-slug-help ul {
  margin: 0.35rem 0 0.55rem 1.1rem;
  padding: 0;
}

.dev-baseline-slug-help li {
  margin: 0.2rem 0;
}

.dev-baseline-copy,
.dev-baseline-status {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
  margin: 0 0 0.55rem;
}

.dev-baseline-copy code,
.dev-baseline-status code {
  font-size: 0.72rem;
}

.dev-baseline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: stretch;
}

.dev-baseline-dropzone {
  flex: 1 1 220px;
  min-height: 4.5rem;
  padding: 0.65rem 0.85rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dev-baseline-dropzone:hover,
.dev-baseline-dropzone:focus-visible,
.dev-baseline-dropzone.drag-over {
  border-color: var(--text);
  background: var(--panel-raised);
  outline: none;
}

.dev-baseline-dropzone-title {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  color: var(--text);
}

.dev-baseline-dropzone-copy {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.dev-baseline-dropzone-copy code {
  font-size: 0.7rem;
}

.dev-baseline-file {
  margin: 0.35rem 0 0.55rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.dev-baseline-file code {
  font-size: 0.72rem;
  color: var(--text);
}

.dev-baseline-upload span {
  display: inline-block;
  font-size: 0.76rem;
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
}

.dev-baseline-upload span:hover {
  border-color: var(--text);
}

.dev-baseline-delete-btn {
  font-size: 0.76rem;
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
  border: 1px solid rgba(245, 16, 0, 0.35);
  background: rgba(245, 16, 0, 0.08);
  color: var(--loss);
  cursor: pointer;
}

.dev-baseline-delete-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.dev-push-alerts-group-label {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a9a9a;
}

.dev-push-alerts-hint {
  color: #7a7a7a;
  font-size: 0.72rem;
}

.dev-push-alerts-date-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.35rem 0 0.15rem 1.45rem;
  font-size: 0.78rem;
  color: #b8b4b4;
}

.dev-push-alerts-date-row[hidden] {
  display: none;
}

.dev-push-alerts-date-row input[type="date"] {
  background: #161616;
  color: #e8e4e4;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  font: inherit;
  color-scheme: dark;
}

.management-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.35rem;
}

.management-expander > summary {
  color: #c8c4c4;
}

.dev-baseline-note {
  color: var(--muted);
  font-size: 0.72rem;
  margin: 0.55rem 0 0;
}

.dev-danger-zone {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(245, 16, 0, 0.25);
}

.dev-danger-zone h3 {
  color: var(--loss);
  font-size: 0.82rem;
  font-weight: 400;
  margin: 0 0 0.45rem;
}

.dev-danger-copy {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
  margin: 0 0 0.75rem;
}

.dev-danger-copy code {
  color: var(--text);
  font-size: 0.74rem;
}

.dev-danger-btn {
  background: rgba(245, 16, 0, 0.12);
  border: 1px solid rgba(245, 16, 0, 0.45);
  border-radius: 6px;
  color: var(--loss);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 400;
  padding: 0.45rem 0.75rem;
}

.dev-danger-btn:hover:not(:disabled) {
  background: rgba(245, 16, 0, 0.18);
}

.dev-danger-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.dev-danger-copy-secondary {
  margin-top: 0.85rem;
}

.dev-danger-btn-secondary {
  background: transparent;
  border-color: rgba(245, 16, 0, 0.28);
  color: var(--muted);
}

.dev-danger-btn-secondary:hover:not(:disabled) {
  background: rgba(245, 16, 0, 0.08);
  color: var(--loss);
}

.dev-danger-note {
  color: var(--loss);
  font-size: 0.72rem;
  margin: 0.55rem 0 0;
}

.dev-discord-panel {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.dev-discord-panel-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.dev-discord-copy strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 400;
  margin-bottom: 0.2rem;
}

.dev-discord-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

.dev-discord-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  font-size: 0.76rem;
  cursor: pointer;
  user-select: none;
}

.dev-discord-toggle input {
  accent-color: var(--accent);
}

.params-meta,
.tech-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.params-meta-item,
.tech-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.params-meta-item dt,
.tech-meta-item dt {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.params-meta-item dd {
  margin: 0;
  font-size: 0.88rem;
  word-break: break-word;
}

#technicalMetadataSection .tech-meta-item dd {
  margin: 0;
  color: #d0d0d0;
  font-size: 0.54rem;
  font-weight: 400;
  line-height: 1.35;
  word-break: break-word;
}

.tech-meta-item dd {
  margin: 0;
  font-size: 0.88rem;
  word-break: break-word;
}

.params-table-wrap {
  margin-top: 0.25rem;
}

.params-table {
  width: 100%;
}

.params-table th,
.params-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.params-table th {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.param-label {
  color: var(--text);
  width: 42%;
  font-size: 0.72rem;
}

.param-value {
  color: #c8c8c8;
  font-size: 0.72rem;
}

.tech-meta-subsection {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.tech-meta-subsection h3 {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#technicalMetadataSection {
  margin-top: 0.75rem;
}

#technicalMetadataSection:empty {
  margin-top: 0;
}

#parametersSection .tech-meta-subsection {
  margin-top: 1.25rem;
}

#parametersSection .empty {
  margin: 0;
}

.params-dev-note {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 300;
}

.section-subtitle {
  margin: -0.35rem 0 1rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 300;
  line-height: 1.45;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem 1.25rem;
}

.profile-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.profile-item dt {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-item dd {
  margin: 0;
  font-size: 0.92rem;
}

.profile-overview-link {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
}

.profile-overview-link a {
  color: var(--accent, #7eb8da);
  text-decoration: none;
}

.profile-overview-link a:hover {
  text-decoration: underline;
}

.profile-overview-note {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.status-section-divider {
  margin: 1.1rem 0 0.85rem;
  border: 0;
  border-top: 1px solid var(--border);
}

.status-note-banner {
  padding: 0.75rem 0.9rem;
  border-radius: 6px;
}

.status-note-text {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.5;
  white-space: pre-line;
}

.status-note-neutral {
  border: 1px solid var(--border);
  background: var(--panel-raised);
}

.status-note-neutral .status-note-text {
  color: var(--text);
}

.status-note-red {
  border: 1px solid rgba(245, 16, 0, 0.45);
  background: rgba(245, 16, 0, 0.1);
}

.status-note-red .status-note-text {
  color: var(--loss);
}

.status-note-orange {
  border: 1px solid rgba(224, 138, 0, 0.45);
  background: rgba(224, 138, 0, 0.1);
}

.status-note-orange .status-note-text {
  color: var(--stale);
}

.status-note-green {
  border: 1px solid rgba(4, 189, 25, 0.45);
  background: rgba(4, 189, 25, 0.1);
}

.status-note-green .status-note-text {
  color: var(--profit);
}

.status-note-blue {
  border: 1px solid rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
}

.status-note-blue .status-note-text {
  color: #93c5fd;
}

.status-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.scope-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0.35rem 0 0.85rem;
}

.scope-toolbar[hidden] {
  display: none !important;
}

.scope-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 300;
  flex: 1 1 16rem;
}

.stitch-notice {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 300;
}

.scope-toggle button.active {
  color: var(--text);
  background: var(--panel);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.05rem;
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-right: 0.55rem;
}

.view-toggle button {
  border: none;
  border-radius: 0;
  background: var(--panel-raised);
  color: var(--muted);
  padding: 0.32rem 0.72rem;
  font-size: 0.72rem;
}

.view-toggle button + button {
  border-left: 1px solid var(--border);
}

.view-toggle button.active {
  background: #404040;
  color: #ffffff;
}

#alertsToggle.active {
  background: rgba(4, 189, 25, 0.14);
  border-color: rgba(4, 189, 25, 0.45);
  color: var(--online);
}

.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  background: #1a1a1a;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 26px;
  padding: 0.3rem 1rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.dev-footer-link {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  letter-spacing: 0.04em;
  padding: 0;
}

.dev-footer-link:hover {
  color: var(--text);
}

.dev-footer-link.active {
  color: #d4a017;
}

.dev-footer-link[hidden] {
  display: none !important;
}

.dev-unlock-overlay,
.site-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.62);
}

.dev-unlock-overlay[hidden],
.site-modal-overlay[hidden] {
  display: none !important;
}

.dev-unlock-dialog,
.site-modal-dialog {
  width: min(100%, 22rem);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem 1.05rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.dev-unlock-title,
.site-modal-title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text);
}

.site-modal-message {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  font-weight: 300;
  line-height: 1.45;
  color: var(--muted);
}

.dev-unlock-field,
.site-modal-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  font-size: 0.76rem;
  color: var(--muted);
}

.dev-unlock-field input,
.site-modal-field input {
  width: 100%;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  padding: 0.45rem 0.55rem;
}

.dev-unlock-field input:focus,
.site-modal-field input:focus {
  outline: none;
  border-color: #666;
}

.dev-unlock-error,
.site-modal-error {
  margin: 0 0 0.75rem;
  font-size: 0.74rem;
  color: var(--offline);
}

.dev-unlock-actions,
.site-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
}

.dev-unlock-cancel,
.dev-unlock-submit,
.site-modal-cancel,
.site-modal-confirm {
  font-size: 0.72rem;
}

.site-modal-confirm.danger {
  color: #fff;
  background: rgba(245, 16, 0, 0.82);
  border-color: rgba(245, 16, 0, 0.55);
}

.site-modal-confirm.danger:hover {
  background: rgba(245, 16, 0, 0.95);
  color: #fff;
}

.developer-mode-banner {
  background: rgba(255, 193, 7, 0.12);
  border-bottom: 1px solid rgba(255, 193, 7, 0.35);
  color: #d4a017;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  padding: 0.45rem 1rem;
  text-align: center;
}

.developer-mode-banner[hidden] {
  display: none !important;
}

.badge.replay {
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.35);
  color: #d4a017;
}

.badge.dev-hidden {
  background: rgba(225, 222, 222, 0.06);
  border: 1px solid var(--border);
  color: var(--muted);
}

.strategy-title-badges {
  display: inline-flex;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.strategy-title-badges .badge-group {
  gap: 0.35rem;
}

.alert-toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}

.alert-toast {
  pointer-events: auto;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
  font-size: 0.76rem;
  font-weight: 300;
  line-height: 1.35;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.alert-toast-hide {
  opacity: 0;
  transform: translateY(-4px);
}

.alert-toast-title {
  color: var(--text);
  font-weight: 400;
  margin-bottom: 0.12rem;
}

.alert-toast-detail {
  color: var(--muted);
}

.alert-toast-machine {
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 300;
  line-height: 1.2;
}

.alert-toast-sep {
  color: var(--muted);
}

.alert-toast-pnl {
  font-weight: 400;
}

.alert-toast-note {
  margin-top: 0.35rem;
  color: var(--stale);
  font-size: 0.68rem;
}

.view-panel[hidden] { display: none !important; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
}

.dashboard-view-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.85rem;
}

.dashboard-view-toolbar[hidden] {
  display: none !important;
}

.dashboard-view-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dashboard-view-toggle button {
  min-width: 4.5rem;
}

.dashboard-status-note-editor {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--muted);
  position: relative;
}

.dashboard-status-note-editor summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.dashboard-status-note-editor summary::-webkit-details-marker {
  display: none;
}

.dashboard-status-note-editor-panel {
  position: absolute;
  z-index: 20;
  right: 0;
  margin-top: 0.35rem;
  width: min(22rem, calc(100vw - 2rem));
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.dashboard-status-note-editor-copy {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.dashboard-status-note-actions {
  gap: 0.45rem;
}

.dashboard-status-note-banner {
  margin: 0 0 0.85rem;
}

.dashboard-status-note-banner[hidden] {
  display: none !important;
}

.dashboard-status-note-banner .status-note-banner {
  margin: 0;
  padding: 0.55rem 0.75rem;
}

.dashboard-status-note-banner .status-note-text {
  font-size: 0.72rem;
  line-height: 1.45;
}

.dashboard-status-note-banner .status-note-neutral .status-note-text {
  color: #9a9898;
}

.card-scope-label {
  margin-left: 0.4rem;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 300;
  white-space: nowrap;
}

.strategy-card--strategy {
  border-color: rgba(90, 90, 90, 0.85);
}

.strategy-card--run {
  border-style: dashed;
  border-color: rgba(80, 80, 80, 0.75);
}

.strategy-card {
  container-type: inline-size;
  container-name: strategy-card;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  line-height: 1.35;
  min-width: 0;
  overflow-x: clip;
}

.strategy-card:hover {
  border-color: #555555;
}

.strategy-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 0.5rem;
  row-gap: 0.35rem;
  min-width: 0;
}

.strategy-card-header-main {
  min-width: 0;
}

.strategy-card-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1.15rem;
  min-width: 0;
  max-width: 100%;
  text-align: right;
}

.strategy-card-status {
  min-width: 0;
  max-width: 100%;
}

.strategy-card-status .badge-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

.strategy-card-name {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Stack title and badges when the card itself is too narrow for both regions. */
@container strategy-card (max-width: 18rem) {
  .strategy-card-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .strategy-card-header-right {
    align-items: flex-start;
    text-align: left;
    gap: 0.45rem;
  }

  .strategy-card-status .badge-group {
    justify-content: flex-start;
  }
}

.strategy-card-name a { color: #f0f0ee; }

.strategy-card-env {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 300;
  margin-top: 0.15rem;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.strategy-card-instrument {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 300;
  color: var(--muted);
  letter-spacing: 0.01em;
  line-height: 1.25;
  white-space: nowrap;
}

.strategy-card-metrics {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 300;
}

.strategy-card-spacer {
  height: 0.35rem;
}

.strategy-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  font-size: 0.8rem;
  font-weight: 300;
}

.strategy-card-metrics dt,
.strategy-card dt {
  color: var(--muted);
  margin: 0;
}

.strategy-card-metrics dd,
.strategy-card dd {
  margin: 0;
  text-align: right;
}

.strategy-card-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.05rem;
}

.status-value { font-weight: 400; }

@media (max-width: 640px) {
  header {
    flex-direction: column;
    align-items: stretch;
    padding-right: 0.75rem;
  }

  .header-actions {
    align-self: flex-end;
    flex: 0 0 auto;
    justify-content: flex-end;
    margin-top: 0.15rem;
    margin-right: -0.1rem;
  }

  #alertsToggle {
    margin-left: -3.5rem;
  }

  #alertsToggle + #refreshBtn {
    margin-left: 3.35rem;
  }

  .site-footer,
  #siteFooter.site-footer {
    padding-right: max(2.65rem, calc(env(safe-area-inset-right, 0px) + 1.75rem));
    padding-bottom: max(0.35rem, env(safe-area-inset-bottom, 0px));
  }

  .dev-footer-link {
    margin-right: 0.1rem;
  }

  body.page-dashboard {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  body.page-dashboard header {
    padding-right: 0.75rem;
  }

  body.page-dashboard .header-actions {
    margin-right: 0;
  }

  body.page-dashboard #alertsToggle {
    margin-left: -3rem;
  }

  body.page-dashboard #alertsToggle + #refreshBtn {
    margin-left: 3.35rem;
  }

  body.page-dashboard .site-footer,
  body.page-dashboard #siteFooter.site-footer {
    padding-right: max(2.65rem, calc(env(safe-area-inset-right, 0px) + 1.75rem));
  }

  body.page-dashboard .dev-footer-link {
    margin-right: 0.1rem;
  }
}
