:root {
  color: #101828;
  background: #f5f9ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: geometricPrecision;
  --bg: #f5f9ff;
  --surface: #ffffff;
  --surface-strong: #f8fbff;
  --ink: #101828;
  --muted: #66758a;
  --line: #d8e6f4;
  --line-strong: #b8cde4;
  --nav: #ffffff;
  --nav-2: #f8fbff;
  --accent: #2268ff;
  --accent-2: #00a77e;
  --accent-soft: #eaf3ff;
  --warning: #9a6b12;
  --warning-soft: #fff5d8;
  --danger: #b42318;
  --danger-2: #8f1f17;
  --danger-soft: #fff0ed;
  --success: #16714f;
  --success-soft: #e8f6ef;
  --shadow-sm: 0 1px 2px rgb(15 35 66 / 7%), 0 8px 22px rgb(41 87 138 / 6%);
  --shadow-md: 0 14px 34px rgb(36 92 155 / 12%);
  --shadow-lg: 0 24px 60px rgb(36 92 155 / 16%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  overflow-x: hidden;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, #eef7ff 0, #f8fbff 360px, #f5f9ff 100%),
    var(--bg);
}

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

button,
input,
select,
textarea {
  min-width: 0;
}

img,
svg,
canvas,
video {
  max-width: 100%;
  height: auto;
}

pre,
code,
small,
strong,
span,
p,
li,
dd,
dt {
  min-width: 0;
}

button {
  position: relative;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  overflow-wrap: anywhere;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: #8eb6e8;
  box-shadow: var(--shadow-md);
}

button:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 2px 8px rgb(17 27 38 / 12%);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgb(18 110 130 / 24%);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
  box-shadow: none;
}

.primary-action {
  border-color: #1d62ef;
  color: #ffffff;
  background: linear-gradient(135deg, #2268ff, #00a77e);
}

.primary-action:hover {
  border-color: #164ed0;
  background: linear-gradient(135deg, #1b5df0, #00966f);
}

.secondary-action {
  border-color: #b9d1ec;
  color: #163b66;
  background: linear-gradient(180deg, #ffffff, #f3f8ff);
}

.warning-action {
  border-color: #9a6b12;
  color: #ffffff;
  background: linear-gradient(180deg, #c88a19, #9a6b12);
}

.warning-action:hover {
  border-color: #7b540d;
  background: linear-gradient(180deg, #d59624, #84590e);
}

.danger-action {
  border-color: #a5271d;
  color: #ffffff;
  background: linear-gradient(180deg, #c8372b, #9f241b);
}

.danger-action:hover {
  border-color: var(--danger-2);
  background: linear-gradient(180deg, #d23b2e, #8f1f17);
}

.is-busy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgb(255 255 255 / 45%);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#app {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--nav), var(--nav-2));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 30px rgb(36 92 155 / 10%);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 245px;
  max-width: 100%;
  gap: 12px;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgb(34 104 255 / 16%);
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 30%), 0 10px 22px rgb(34 104 255 / 18%);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand span:not(.brand-mark) {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.brand strong {
  line-height: 1.1;
  font-size: 15px;
  letter-spacing: 0;
}

.brand span:not(.brand-mark) {
  margin-top: 3px;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

nav button {
  flex: 0 1 auto;
  min-height: 34px;
  max-width: 100%;
  border-color: #dce8f6;
  color: #31455c;
  background: #ffffff;
  box-shadow: none;
}

nav button:hover {
  color: var(--accent);
  border-color: #b7d0f1;
  background: #f4f9ff;
}

nav button.active {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, #2268ff, #00a77e);
  box-shadow: 0 10px 24px rgb(34 104 255 / 18%);
}

.nav-toggle {
  display: none;
  flex: 0 0 auto;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  border-color: #c6dbf3;
  padding: 0;
  background: #ffffff;
  box-shadow: none;
}

.nav-toggle span {
  position: absolute;
  left: 11px;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    top 180ms ease;
}

.nav-toggle span:nth-child(1) {
  top: 13px;
}

.nav-toggle span:nth-child(2) {
  top: 20px;
}

.nav-toggle span:nth-child(3) {
  top: 27px;
}

.nav-toggle.open span:nth-child(1) {
  top: 20px;
  transform: rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  top: 20px;
  transform: rotate(-45deg);
}

.content {
  width: min(100%, 1220px);
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.page-heading > div:first-child {
  min-width: 0;
}

.page-heading h1 {
  margin: 4px 0 0;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.page-heading p:not(.eyebrow) {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.identity-pill {
  flex: 0 1 auto;
  max-width: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: #244258;
  background: rgb(255 255 255 / 78%);
  box-shadow: var(--shadow-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.hero {
  display: flex;
  align-items: center;
  min-height: 220px;
  border: 1px solid #cce0fb;
  border-radius: 8px;
  padding: 32px;
  color: var(--ink);
  background:
    linear-gradient(135deg, #ffffff 0%, #eef6ff 56%, #e9fff7 100%),
    #ffffff;
  box-shadow: var(--shadow-lg);
}

.hero h1 {
  margin: 8px 0;
  color: #0b1f3a;
  font-size: 42px;
  line-height: 1.06;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.hero p:not(.eyebrow) {
  margin: 0;
  color: #4f6279;
  line-height: 1.55;
}

.hero-status-explainer {
  max-width: 980px;
  margin-top: 14px !important;
  color: #25415f !important;
}

.home-hero h1 {
  max-width: 920px;
}

.next-step-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
  border-left: 4px solid var(--accent);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.next-step-copy span,
.next-step-status span {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.next-step-copy strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.next-step-copy p,
.next-step-status p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.workflow-panel,
.advanced-tools-panel {
  margin-top: 18px;
}

.page-coach {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.4fr);
  gap: 18px;
  align-items: stretch;
  margin: 18px 0;
  border-left: 5px solid var(--accent);
  background: linear-gradient(135deg, #ffffff 0%, #f6fbfc 100%);
}

.page-coach-copy {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
}

.page-coach-copy span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-coach-copy strong {
  color: var(--ink);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.page-coach-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

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

.coach-step {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "number title"
    "number copy";
  gap: 4px 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-strong);
}

.coach-step span {
  grid-area: number;
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 13px;
  font-weight: 900;
}

.coach-step strong {
  grid-area: title;
  color: var(--ink);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.coach-step p {
  grid-area: copy;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.coach-ok {
  border-left: 4px solid var(--success);
  background: linear-gradient(180deg, #ffffff, var(--success-soft));
}

.coach-warn {
  border-left: 4px solid var(--warning);
  background: linear-gradient(180deg, #ffffff, var(--warning-soft));
}

.coach-bad {
  border-left: 4px solid var(--danger);
  background: linear-gradient(180deg, #ffffff, var(--danger-soft));
}

.coach-neutral {
  border-left: 4px solid var(--accent);
}

.advanced-disclosure {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.advanced-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
  transition: background 160ms ease;
}

.advanced-disclosure > summary::-webkit-details-marker {
  display: none;
}

.advanced-disclosure > summary::after {
  content: "Open";
  flex: 0 0 auto;
  border: 1px solid rgba(20, 119, 134, 0.34);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--accent);
  background: rgba(20, 119, 134, 0.08);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.advanced-disclosure[open] > summary::after {
  content: "Hide";
}

.advanced-disclosure > summary:hover {
  background: var(--surface-strong);
}

.advanced-disclosure > summary span,
.advanced-disclosure > summary small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.advanced-disclosure > summary span {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
}

.advanced-disclosure > summary small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.advanced-disclosure-body {
  display: grid;
  gap: 16px;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding: 16px;
  background: #ffffff;
}

.advanced-disclosure-body > .panel {
  margin: 0;
  box-shadow: none;
}

.status-note-embedded {
  margin: 0;
  box-shadow: none;
}

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

.workflow-step {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 15px;
  background: var(--surface-strong);
}

.workflow-step.workflow-ok {
  border-left-color: var(--success);
  background: linear-gradient(180deg, #ffffff, var(--success-soft));
}

.workflow-step.workflow-warn {
  border-left-color: var(--warning);
  background: linear-gradient(180deg, #ffffff, var(--warning-soft));
}

.workflow-step.workflow-bad {
  border-left-color: var(--danger);
  background: linear-gradient(180deg, #ffffff, var(--danger-soft));
}

.workflow-step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.workflow-step-number {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 13px;
  font-weight: 900;
}

.workflow-step strong {
  color: var(--ink);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.workflow-step p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.workflow-action {
  align-self: end;
  width: 100%;
  min-width: 0;
}

.run-center-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.run-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.run-card-ok {
  border-left-color: var(--success);
}

.run-card-warn {
  border-left-color: var(--warning);
}

.run-card-bad {
  border-left-color: var(--danger);
}

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

.run-card-header > span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.run-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.run-card button {
  justify-self: start;
}

.advanced-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 12px;
}

.advanced-link-card {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 16px;
  text-align: left;
  background: linear-gradient(180deg, #ffffff, #f7fbfd);
}

.advanced-link-card strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
}

.advanced-link-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 16px;
  margin-top: 18px;
}

.tile,
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.tile {
  padding: 18px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.tile:hover {
  transform: translateY(-2px);
  border-color: #b9d1ec;
  box-shadow: var(--shadow-md);
}

.tile span,
.tile small {
  display: block;
  color: var(--muted);
}

.tile span {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.tile strong {
  display: block;
  margin: 8px 0;
  font-size: 28px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.tile small {
  line-height: 1.45;
}

.panel {
  padding: 18px;
}

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

.panel-title > div {
  min-width: 0;
}

.panel-title span,
.panel-title strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.panel-title span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.panel-title strong {
  margin-top: 2px;
  font-size: 18px;
}

.list-panel {
  display: grid;
  gap: 10px;
}

.list-panel p,
.status-note p,
.login-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.list-panel p {
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  background: var(--surface-strong);
}

.callout {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  line-height: 1.5;
}

.callout.compact {
  padding: 10px 12px;
  font-size: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.control-actions {
  align-items: stretch;
}

.control-state-panel {
  margin-top: 16px;
}

.control-state-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 10px;
}

.control-state-copy {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.actions button,
.form-panel button[type="submit"],
.login-panel button,
#refresh-brokers {
  flex: 1 1 150px;
  min-width: 150px;
}

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

.form-panel {
  width: 100%;
  max-width: 640px;
}

.admin-config-option {
  min-width: 0;
}

.admin-subsection {
  margin-top: 8px;
  margin-bottom: 0;
}

.backtest-config-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

.backtest-config-layout .form-panel {
  max-width: none;
  min-width: 0;
}

.strategy-code-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.strategy-code-summary {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px 13px;
  background: var(--surface-strong);
}

.strategy-code-summary p,
.strategy-code-summary small {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.strategy-code-summary p {
  color: #244258;
  font-weight: 700;
}

.strategy-code-summary small {
  color: var(--muted);
}

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

.strategy-code-fact {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  background: #fbfdff;
}

.strategy-code-fact span,
.strategy-code-fact strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.strategy-code-fact span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.strategy-code-fact strong {
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.strategy-code-block {
  min-width: 0;
  max-height: 560px;
  overflow: auto;
  margin: 0;
  border: 1px solid #25384a;
  border-radius: 8px;
  padding: 15px;
  color: #d8e8f1;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 3%), rgb(255 255 255 / 0%)),
    #101b26;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 8%);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  tab-size: 2;
}

.strategy-code-block code {
  display: block;
  min-width: max-content;
  white-space: pre;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #31495b;
  font-size: 14px;
  font-weight: 700;
}

label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-strong);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--ink);
  background: #ffffff;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #8fb0c5;
}

input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(min(320px, 100%), 430px);
  gap: 28px;
  align-items: center;
  min-height: calc(100vh - 142px);
}

.login-copy {
  max-width: 680px;
  padding: 24px 0;
}

.login-copy h1 {
  margin: 8px 0 12px;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: 0;
}

.login-copy p:not(.eyebrow) {
  max-width: 600px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.login-panel {
  display: grid;
  gap: 16px;
  box-shadow: var(--shadow-lg);
}

.login-panel form {
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.status-note {
  max-width: 640px;
  margin-top: 14px;
  background: var(--surface-strong);
}

.status-note strong {
  display: block;
  margin-bottom: 6px;
}

.backtest-status-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
  max-width: none;
  margin-top: 16px;
}

.status-note-inline {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 7px;
  padding: 11px 12px;
  color: #244258;
  background: var(--surface-strong);
  line-height: 1.45;
}

.status-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.status-loading .spinner {
  border-color: rgb(18 110 130 / 22%);
  border-top-color: var(--accent);
}

.field-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}

.field-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  border: 1px solid #b8d4df;
  border-radius: 999px;
  color: var(--accent);
  background: #ffffff;
  box-shadow: 0 2px 6px rgb(17 27 38 / 10%);
  cursor: help;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-transform: none;
}

.field-help-tooltip {
  position: absolute;
  z-index: 60;
  top: calc(100% + 9px);
  left: 50%;
  width: min(280px, calc(100vw - 32px));
  transform: translateX(-50%) translateY(-4px);
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 8px;
  padding: 10px 11px;
  color: #eaf3f6;
  background: #111b26;
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.45;
  opacity: 0;
  overflow-wrap: normal;
  pointer-events: none;
  text-align: left;
  text-transform: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    visibility 160ms ease;
  visibility: hidden;
  white-space: normal;
}

.field-help-tooltip::before {
  position: absolute;
  top: -5px;
  left: calc(50% - 5px);
  width: 10px;
  height: 10px;
  content: "";
  background: #111b26;
  border-left: 1px solid rgb(255 255 255 / 14%);
  border-top: 1px solid rgb(255 255 255 / 14%);
  transform: rotate(45deg);
}

.field-help:hover,
.field-help:focus {
  border-color: var(--accent);
  outline: none;
}

.field-help:hover .field-help-tooltip,
.field-help:focus .field-help-tooltip,
.field-help:focus-within .field-help-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  visibility: visible;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  min-height: 30px;
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.panel-title > .status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.status-ok {
  border-color: #9dd7bd;
  color: var(--success);
  background: var(--success-soft);
}

.status-warn {
  border-color: #e1bd69;
  color: var(--warning);
  background: var(--warning-soft);
}

.status-bad {
  border-color: #efaaa2;
  color: var(--danger);
  background: var(--danger-soft);
}

.status-neutral {
  border-color: #b8d4df;
  color: var(--accent);
  background: var(--accent-soft);
}

.backtest-progress {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f9fb 100%);
}

.backtest-progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce9ef;
}

.backtest-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent) 0%, var(--success) 100%);
  transition: width 240ms ease;
}

.backtest-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.backtest-progress-meta strong {
  color: var(--ink);
}

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

.backtest-activity-feed {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
}

.activity-timeline {
  display: grid;
  gap: 12px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.activity-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
}

.activity-dot {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.activity-body {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.activity-timeline li:last-child .activity-body {
  border-bottom: 0;
  padding-bottom: 0;
}

.activity-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.activity-head strong {
  color: var(--ink);
  font-size: 14px;
}

.activity-head time,
.activity-body p,
.activity-meta,
.activity-error {
  color: var(--muted);
}

.activity-body p {
  margin: 4px 0 8px;
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
}

.activity-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  background: #ffffff;
}

.activity-error {
  display: block;
  margin-top: 8px;
  color: var(--danger);
}

.backtest-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 10px;
}

.backtest-metrics div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px;
  background: #fbfdff;
}

.backtest-metrics span,
.backtest-metrics strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.backtest-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.backtest-metrics .field-label {
  display: inline-flex;
}

.backtest-metrics .field-help {
  display: inline-flex;
  color: var(--accent);
  font-size: 11px;
  text-transform: none;
}

.backtest-metrics .field-help-tooltip {
  display: block;
  width: min(420px, calc(100vw - 32px));
  color: #eaf3f6;
  font-size: 12px;
  text-transform: none;
}

.backtest-metrics strong {
  margin-top: 6px;
  color: var(--ink);
  font-size: 18px;
}

.backtest-complete-summary {
  display: grid;
  gap: 18px;
}

.backtest-gate-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--surface-strong);
}

.backtest-gate-summary > div {
  min-width: 0;
}

.backtest-gate-summary span,
.backtest-gate-summary strong,
.backtest-gate-summary small {
  display: block;
  min-width: 0;
}

.backtest-gate-summary > .status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  min-width: 112px;
  text-align: center;
}

.backtest-gate-summary > div > span,
.backtest-section-title {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.backtest-gate-summary strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.15;
}

.backtest-gate-summary small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.gate-ok {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.gate-bad {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.gate-neutral {
  border-left-color: var(--accent);
}

.paper-promotion-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
}

.paper-promotion-panel > div {
  min-width: 0;
}

.paper-promotion-panel span,
.paper-promotion-panel strong,
.paper-promotion-panel small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.paper-promotion-panel span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.paper-promotion-panel strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.15;
}

.paper-promotion-panel small {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.paper-promotion-panel button {
  min-width: 160px;
}

.promotion-action-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.force-promotion-note {
  border: 1px solid var(--line);
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fffdf6;
}

.force-promotion-note strong,
.force-promotion-note small {
  display: block;
}

.force-promotion-note small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.promotion-ready {
  border-left-color: var(--success);
  background: linear-gradient(180deg, #fbfffd 0%, var(--success-soft) 100%);
}

.promotion-blocked {
  border-left-color: var(--warning);
  background: linear-gradient(180deg, #fffdf6 0%, var(--warning-soft) 100%);
}

.paper-trading-panel {
  display: grid;
  gap: 16px;
}

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

.paper-execution-grid label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.paper-execution-grid select {
  width: 100%;
  min-width: 0;
}

.paper-execution-grid small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-transform: none;
}

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.checkbox-row input {
  flex: 0 0 auto;
  margin-top: 2px;
}

.checkbox-row span {
  min-width: 0;
}

.data-readiness-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

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

.data-readiness-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfdff;
}

.data-readiness-card.selected {
  border-color: rgba(20, 119, 134, 0.56);
  box-shadow: 0 0 0 3px rgba(20, 119, 134, 0.1);
}

.data-readiness-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.data-readiness-card strong {
  color: var(--ink);
}

.data-readiness-card code,
.data-readiness-card small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.data-readiness-card small {
  color: var(--muted);
  line-height: 1.4;
}

.paper-session-policy {
  display: grid;
  grid-template-columns: minmax(220px, 0.55fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #f8fbfd;
}

.paper-session-policy span,
.paper-session-policy strong {
  display: block;
}

.paper-session-policy span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.paper-session-policy strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.paper-session-policy ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.paper-session-policy code {
  color: var(--ink);
  font-size: 0.92em;
  font-weight: 800;
}

.live-approval-workflow {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--warning);
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(180deg, #fffdf6 0%, #fbfdff 100%);
}

.live-approval-workflow.full-live {
  border-left-color: var(--danger);
  background: linear-gradient(180deg, #fff8f7 0%, #fbfdff 100%);
}

.workflow-header,
.approval-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.workflow-header > div,
.approval-actions small {
  min-width: 0;
}

.workflow-header span,
.workflow-header strong,
.workflow-header small,
.approval-actions small {
  display: block;
  overflow-wrap: anywhere;
}

.workflow-header .field-label {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.workflow-header strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.15;
}

.workflow-header small,
.approval-actions small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

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

.approval-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.approval-grid input[type="text"],
.approval-grid input:not([type]) {
  min-width: 0;
}

.checkbox-field {
  align-items: center;
  grid-template-columns: auto 1fr;
  justify-content: start;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-transform: none;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
}

.backtest-section-title {
  margin-bottom: 8px;
}

.backtest-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.backtest-detail-item {
  display: grid;
  grid-template-columns: minmax(120px, 0.42fr) minmax(0, 1fr);
  gap: 8px 16px;
  align-items: center;
  min-width: 0;
  padding: 13px 14px;
  background: #fbfdff;
}

.backtest-detail-item span,
.backtest-detail-item small {
  color: var(--muted);
}

.backtest-detail-item span {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.backtest-detail-item .field-label,
.health-row .field-label,
.paper-promotion-panel .field-label,
.backtest-gate-summary .field-label {
  color: var(--muted);
}

.backtest-detail-item .field-help,
.health-row .field-help,
.paper-promotion-panel .field-help,
.backtest-gate-summary .field-help {
  color: var(--accent);
  font-size: 11px;
  text-transform: none;
}

.backtest-detail-item .field-help-tooltip,
.health-row .field-help-tooltip,
.paper-promotion-panel .field-help-tooltip,
.backtest-gate-summary .field-help-tooltip {
  color: #eaf3f6;
  font-size: 12px;
  text-transform: none;
}

.backtest-detail-item strong {
  min-width: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.backtest-detail-item small {
  grid-column: 2;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.backtest-metric-item {
  border-left: 4px solid var(--accent);
}

.backtest-metric-item small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.metric-ok {
  border-left-color: var(--success);
}

.metric-warn {
  border-left-color: var(--warning);
  background: var(--warning-soft);
}

.metric-bad {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.backtest-artifacts {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fbfdff;
}

.backtest-artifacts summary {
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.backtest-artifact-body {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.backtest-artifact-body code {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #f4f8fb;
  font-size: 12px;
}

.backtest-runs-stack {
  display: grid;
  gap: 16px;
  min-width: 0;
  margin-top: 16px;
}

.backtest-runs-panel {
  min-width: 0;
}

.backtest-run-table {
  display: grid;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.backtest-run-head,
.backtest-run-row {
  display: grid;
  grid-template-columns:
    minmax(112px, 0.8fr)
    minmax(70px, 0.45fr)
    minmax(210px, 1.4fr)
    minmax(90px, 0.65fr)
    minmax(180px, 1fr)
    minmax(100px, 0.65fr);
  min-width: 900px;
  gap: 10px;
  align-items: center;
}

.backtest-run-head {
  border-bottom: 1px solid var(--line);
  padding: 0 4px 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.backtest-run-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: var(--surface-strong);
}

.backtest-run-row > span,
.backtest-run-head > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.backtest-run-row > span {
  color: #263c4f;
  line-height: 1.4;
}

.backtest-run-row > span::before {
  display: none;
}

.artifact-link {
  margin-top: 0;
}

.compact-action {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 12px;
  white-space: nowrap;
}

.backtest-history-details-panel {
  min-width: 0;
}

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

.historical-backtest-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fbfdff;
}

.historical-backtest-card span,
.historical-backtest-card strong,
.historical-backtest-card small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.historical-backtest-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.historical-backtest-card strong {
  margin-top: 6px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.15;
}

.historical-backtest-card small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.compact-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 13px;
}

.compact-table th,
.compact-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.compact-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  background: #f7fafc;
}

.compact-table td {
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}

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

.secured-artifact-note {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface-strong);
  color: #263c4f;
  overflow-wrap: anywhere;
}

.route-loading {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 92%), rgb(247 251 253 / 92%)),
    var(--surface);
  box-shadow: var(--shadow-md);
}

.route-loading::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.route-loading::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 4px;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: route-progress 1200ms ease-in-out infinite;
}

.route-spinner {
  display: inline-grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 3px solid #d7e7ee;
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  border-radius: 999px;
  animation: spin 820ms linear infinite;
}

.route-loading strong,
.route-loading span {
  display: block;
}

.route-loading strong {
  color: var(--ink);
  font-size: 17px;
}

.route-loading span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.confirm-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(17 27 38 / 46%);
  backdrop-filter: blur(10px);
  animation: confirm-fade 140ms ease-out;
}

.confirm-overlay.is-closing {
  animation: confirm-fade 120ms ease-in reverse;
}

.confirm-dialog {
  position: relative;
  width: min(100%, 560px);
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 70%);
  border-radius: 8px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 98%), rgb(247 251 253 / 98%)),
    var(--surface);
  box-shadow: 0 28px 80px rgb(17 27 38 / 28%);
  animation: confirm-rise 160ms ease-out;
}

.confirm-accent {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.confirm-danger .confirm-accent {
  background: linear-gradient(180deg, #e5483d, var(--danger));
}

.confirm-warn .confirm-accent {
  background: linear-gradient(180deg, #d99822, var(--warning));
}

.confirm-success .confirm-accent {
  background: linear-gradient(180deg, #28a77f, var(--success));
}

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

.confirm-header > div {
  min-width: 0;
}

.confirm-header h2 {
  margin: 4px 0 0;
  font-size: 26px;
  line-height: 1.12;
  letter-spacing: 0;
}

.confirm-icon-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 999px;
  padding: 0;
  color: var(--muted);
  background: #f4f8fb;
}

.confirm-copy {
  margin: 14px 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.confirm-reason {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.confirm-reason span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.confirm-reason textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px 11px;
  resize: vertical;
}

.confirm-reason small {
  color: var(--muted);
  line-height: 1.45;
}

.input-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.12) !important;
}

.confirm-details {
  display: grid;
  gap: 10px;
  margin: 0;
}

.confirm-details div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  background: var(--surface-strong);
}

.confirm-details dt,
.confirm-details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.confirm-details dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.confirm-details dd {
  color: #203548;
  font-weight: 700;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

@keyframes route-progress {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

@keyframes confirm-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes confirm-rise {
  from {
    transform: translateY(12px) scale(0.98);
  }

  to {
    transform: translateY(0) scale(1);
  }
}

.health-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.health-panel {
  display: grid;
  gap: 10px;
}

.health-row {
  display: grid;
  grid-template-columns: minmax(min(150px, 100%), 0.8fr) minmax(0, 1fr);
  gap: 8px 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 7px;
  padding: 11px 12px;
  background: var(--surface-strong);
}

.health-row span,
.health-row small {
  color: var(--muted);
}

.health-row span {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.health-row strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.health-row small {
  grid-column: 2;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.health-ok {
  border-left-color: var(--success);
}

.health-warn {
  border-left-color: var(--warning);
  background: var(--warning-soft);
}

.health-bad {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.health-neutral {
  border-left-color: var(--accent);
}

.instance-panel {
  margin-top: 16px;
}

.instance-list {
  display: grid;
  gap: 10px;
}

.instance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: var(--surface-strong);
}

.instance-row strong,
.instance-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.instance-row span {
  color: var(--muted);
}

.data-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.data-panel {
  min-width: 0;
}

.data-panel-wide {
  grid-column: 1 / -1;
}

.analytics-guide-panel,
.analytics-period-panel {
  margin-top: 16px;
}

.analytics-guide-grid,
.analytics-period-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
}

.analytics-advanced-grid {
  align-items: stretch;
  margin-top: 16px;
}

.analytics-guide-grid p {
  min-width: 0;
  margin: 0;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--muted);
  background: var(--surface-strong);
  line-height: 1.55;
}

.analytics-guide-grid p:last-child {
  grid-column: 1 / -1;
}

.analytics-guide-grid strong {
  color: var(--ink);
}

.analytics-table-panel {
  min-width: 0;
}

.compact-panel-title {
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.warning-note {
  margin-top: 14px;
  border-left-color: var(--warning);
  color: #60430b;
  background: var(--warning-soft);
}

.strategy-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.strategy-summary-panel {
  position: relative;
  display: grid;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  border-left: 4px solid var(--accent);
}

.strategy-summary-panel > span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.strategy-summary-panel > strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.strategy-summary-panel > small {
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.summary-ok {
  border-left-color: var(--success);
}

.summary-warn {
  border-left-color: var(--warning);
  background: var(--warning-soft);
}

.summary-bad {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.summary-neutral {
  border-left-color: var(--accent);
}

.paper-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 16px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 18px 20px;
  background: #fff;
  box-shadow: var(--shadow);
}

.paper-status-banner > div {
  min-width: 0;
}

.paper-status-banner span,
.paper-status-banner strong,
.paper-status-banner small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.paper-status-banner > div > span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.paper-status-banner strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: clamp(26px, 4vw, 44px);
  line-height: 1.05;
}

.paper-status-banner small {
  margin-top: 8px;
  color: var(--muted);
  font-size: 16px;
}

.paper-status-banner.summary-ok {
  border-left-color: var(--success);
  background: linear-gradient(180deg, #ffffff 0%, #f3fbf6 100%);
}

.paper-status-banner.summary-warn {
  border-left-color: var(--warning);
  background: var(--warning-soft);
}

.paper-status-banner.summary-bad {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.paper-session-detail-panel {
  margin-top: 16px;
}

.ibkr-auth-workflow-panel {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.grid > .ibkr-auth-workflow-panel {
  grid-column: 1 / -1;
}

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

.auth-workflow-steps > div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
}

.auth-workflow-steps span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.auth-workflow-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.auth-command {
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: 16px;
  margin-top: 18px;
}

.strategy-workbench {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1.35fr);
  gap: 16px;
  align-items: start;
  margin-top: 18px;
}

.strategy-list-panel,
.strategy-detail-panel {
  min-width: 0;
}

.strategy-grid-compact {
  grid-template-columns: 1fr;
  margin-top: 14px;
}

.strategy-card {
  display: grid;
  gap: 14px;
}

.strategy-card-button {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

.strategy-card-button:hover {
  border-color: rgba(20, 119, 134, 0.42);
  box-shadow: 0 16px 32px rgba(15, 38, 58, 0.13);
  transform: translateY(-1px);
}

.strategy-card-button.selected {
  border-color: rgba(20, 119, 134, 0.72);
  box-shadow: 0 0 0 3px rgba(20, 119, 134, 0.12), 0 16px 32px rgba(15, 38, 58, 0.12);
  background: linear-gradient(180deg, #ffffff 0%, #f7fcfd 100%);
}

.strategy-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

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

.strategy-card-header span,
.strategy-card-header strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.strategy-card-header > div > span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.strategy-card-header strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.strategy-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.strategy-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.strategy-facts .backtest-detail-item {
  padding: 11px 12px;
}

.strategy-detail-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.strategy-detail-heading span,
.strategy-detail-heading strong,
.strategy-detail-heading small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.strategy-detail-heading span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.strategy-detail-heading strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.15;
}

.strategy-detail-heading small {
  margin-top: 5px;
  color: var(--muted);
}

.strategy-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.strategy-detail-grid .backtest-detail-item {
  padding: 12px;
}

.strategy-raw-details {
  margin-top: 14px;
}

.strategy-event-table {
  display: grid;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.strategy-event-head,
.strategy-event-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(min(150px, 100%), 1fr));
  min-width: min(100%, calc(var(--cols, 4) * 150px));
  gap: 10px;
  align-items: center;
}

.strategy-event-head {
  border-bottom: 1px solid var(--line);
  padding: 0 4px 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.strategy-event-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: var(--surface-strong);
}

.strategy-event-row > span,
.strategy-event-head > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.strategy-event-row > span {
  color: #263c4f;
  line-height: 1.4;
}

.event-details {
  grid-column: 1 / -1;
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.event-details summary {
  width: fit-content;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.event-details pre {
  max-height: 240px;
  margin: 8px 0 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: #e8f3ff;
  background: #111b26;
  font-size: 12px;
  white-space: pre-wrap;
}

.data-table {
  display: grid;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.data-table-head,
.data-table-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(min(150px, 100%), 1fr));
  min-width: min(100%, calc(var(--cols, 4) * 150px));
  gap: 10px;
  align-items: center;
}

.data-table-head {
  border-bottom: 1px solid var(--line);
  padding: 0 4px 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.data-table-row {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  background: var(--surface-strong);
}

.data-table-row span,
.data-table-head span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.data-table-row span {
  color: #263c4f;
  line-height: 1.4;
}

.empty-state {
  display: grid;
  gap: 5px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
}

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

.empty-state span,
.muted-copy {
  color: var(--muted);
  line-height: 1.55;
}

.json-preview {
  max-height: 320px;
  margin: 0;
  overflow: auto;
  border: 1px solid #d8e4ee;
  border-radius: 7px;
  padding: 13px;
  color: #173247;
  background: #f8fbfd;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.journal-panel {
  margin-top: 18px;
}

.journal-frame {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgb(17 27 38 / 5%);
}

.journal-artifact-details {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fbfdff;
}

.journal-artifact-details summary {
  width: fit-content;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.journal-artifact-details code {
  display: block;
  margin-top: 10px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #f4f8fb;
  font-size: 12px;
}

.help-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 22px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 94%), rgb(244 250 251 / 98%)),
    var(--surface);
}

.help-hero h2 {
  max-width: 780px;
  margin: 6px 0 10px;
  color: var(--ink);
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
}

.help-hero p {
  max-width: 850px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.help-warning {
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid #e1bd69;
  border-left: 5px solid var(--warning);
  border-radius: 8px;
  padding: 14px 15px;
  background: var(--warning-soft);
}

.help-warning strong,
.help-warning span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.help-warning strong {
  color: #684709;
  font-size: 17px;
}

.help-warning span {
  color: #5d4c2d;
  line-height: 1.5;
}

.help-section {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.help-section-title {
  display: grid;
  gap: 3px;
}

.help-section-title span,
.help-card-heading span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.help-section-title h2 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.2;
}

.help-card-grid,
.help-promotion-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.help-start-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.help-step-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 12px;
  border-left: 4px solid var(--accent);
  padding-top: 58px;
}

.help-step-number {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #0f766e);
  font-size: 12px;
  font-weight: 900;
}

.help-page-map {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.help-page-card {
  display: grid;
  align-content: start;
  gap: 10px;
  border-left: 4px solid #0f766e;
}

.help-metric-lesson-grid,
.help-control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

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

.help-card,
.help-page-card,
.help-checklist,
.help-details {
  display: grid;
  align-content: start;
  gap: 12px;
  border-left: 4px solid var(--accent);
}

.help-details {
  padding: 0;
  overflow: hidden;
}

.help-details summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  min-width: 0;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

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

.help-details summary::after {
  content: ">";
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(14, 118, 132, 0.24);
  border-radius: 999px;
  color: var(--accent);
  background: rgba(14, 118, 132, 0.08);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.help-details[open] summary::after {
  content: "v";
  color: #0f766e;
  background: rgba(15, 118, 110, 0.1);
}

.help-card-heading {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.help-details summary > span,
.help-details summary > strong,
.help-details summary > small {
  grid-column: 1;
}

.help-details summary > span,
.help-details summary > small {
  color: var(--muted);
}

.help-details summary > span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.help-card-heading strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.help-details summary > strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.help-details summary > small {
  line-height: 1.45;
}

.help-card p,
.help-page-card p,
.help-step-card p,
.help-card li,
.help-page-card li,
.help-step-card li,
.help-checklist li,
.help-details li,
.help-term dd {
  color: var(--muted);
  line-height: 1.55;
}

.help-card p,
.help-page-card p,
.help-step-card p {
  margin: 0;
}

.help-card ul,
.help-page-card ul,
.help-step-card ul,
.help-checklist ol,
.help-details ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.help-details ul {
  padding: 0 22px 18px 40px;
}

.help-card li,
.help-checklist li,
.help-details li {
  padding-left: 2px;
}

.help-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.help-glossary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.help-term {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px 13px;
  background: #fbfdff;
}

.help-term dt {
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.help-term dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.inline-link {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  margin-top: 10px;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.inline-link:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

.result-box {
  display: block;
  width: 100%;
  min-height: 82px;
  max-height: 420px;
  margin-top: 16px;
  overflow: auto;
  border: 1px solid #22364a;
  border-radius: 8px;
  padding: 16px;
  color: #e8f3ff;
  background: #111b26;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 5%);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.result-pending {
  border-color: #c7952e;
  color: #4a3512;
  background: var(--warning-soft);
}

.result-success {
  border-color: #7fc2a3;
  color: #124b35;
  background: var(--success-soft);
}

.result-error {
  border-color: #f0a49b;
  color: #7a1a13;
  background: var(--danger-soft);
}

@media (max-width: 980px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
  }

  .brand {
    min-width: 0;
  }

  .nav-toggle {
    display: inline-grid;
    place-items: center;
  }

  nav {
    grid-column: 1 / -1;
    display: none;
    width: 100%;
    max-height: min(70vh, 560px);
    overflow-y: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
    overscroll-behavior: contain;
  }

  nav.open {
    display: grid;
  }

  nav button {
    width: 100%;
    min-width: 0;
  }

  .page-heading {
    flex-direction: column;
  }

  .identity-pill {
    max-width: 100%;
  }

  .login-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-copy h1 {
    font-size: 36px;
  }

  .health-layout {
    grid-template-columns: 1fr;
  }

  .data-layout {
    grid-template-columns: 1fr;
  }

  .next-step-panel {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .next-step-actions {
    justify-content: flex-start;
  }

  .page-coach {
    grid-template-columns: 1fr;
  }

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

  .workflow-steps,
  .run-center-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .backtest-config-layout {
    grid-template-columns: 1fr;
  }

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

  .strategy-workbench {
    grid-template-columns: 1fr;
  }

  .help-hero,
  .help-start-grid,
  .help-page-map,
  .help-card-grid,
  .help-promotion-grid,
  .help-details-grid,
  .help-metric-lesson-grid,
  .help-control-grid,
  .help-two-column,
  .help-metric-grid,
  .help-glossary {
    grid-template-columns: 1fr;
  }

  .analytics-guide-grid,
  .analytics-period-grid {
    grid-template-columns: 1fr;
  }

  .analytics-guide-grid p:last-child {
    grid-column: auto;
  }

  .backtest-status-grid,
  .backtest-detail-grid,
  .backtest-metrics,
  .historical-backtest-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-pill {
    align-self: flex-start;
  }

  .paper-status-banner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 14px 16px;
  }

  .brand {
    min-width: 0;
  }

  nav {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 20px 14px 36px;
  }

  .page-coach,
  .advanced-disclosure {
    margin-top: 14px;
  }

  .page-coach {
    padding: 16px;
  }

  .coach-steps {
    grid-template-columns: 1fr;
  }

  .coach-step {
    padding: 12px;
  }

  .advanced-disclosure > summary {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .advanced-disclosure > summary::after {
    align-self: flex-start;
  }

  .advanced-disclosure-body {
    padding: 12px;
  }

  .page-heading h1,
  .hero h1 {
    font-size: 30px;
  }

  .page-heading p:not(.eyebrow),
  .hero p:not(.eyebrow),
  .tile small,
  .empty-state span,
  .muted-copy {
    font-size: 14px;
  }

  .hero {
    min-height: 190px;
    padding: 22px;
  }

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

  .workflow-steps,
  .run-center-grid {
    grid-template-columns: 1fr;
  }

  .run-card button,
  .workflow-action {
    width: 100%;
  }

  .run-card-header,
  .workflow-step-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .actions button,
  .form-panel button[type="submit"],
  .login-panel button,
  #refresh-brokers {
    width: 100%;
    min-width: 0;
  }

  .field-label {
    align-items: flex-start;
  }

  .field-help-tooltip {
    right: -8px;
    left: auto;
    transform: translateY(-4px);
  }

  .field-help-tooltip::before {
    right: 12px;
    left: auto;
  }

  .field-help:hover .field-help-tooltip,
  .field-help:focus .field-help-tooltip,
  .field-help:focus-within .field-help-tooltip {
    transform: translateY(0);
  }

  .login-copy h1 {
    font-size: 32px;
  }

  .help-hero h2 {
    font-size: 26px;
  }

  .help-section-title h2 {
    font-size: 21px;
  }

  .login-copy p:not(.eyebrow) {
    font-size: 16px;
  }

  .health-row {
    grid-template-columns: 1fr;
  }

  .health-row small {
    grid-column: auto;
  }

  .auth-workflow-steps {
    grid-template-columns: 1fr;
  }

  .backtest-status-grid,
  .backtest-detail-grid,
  .strategy-detail-grid,
  .strategy-facts,
  .strategy-code-facts,
  .backtest-metrics,
  .historical-backtest-grid {
    grid-template-columns: 1fr;
  }

  .strategy-code-block {
    max-height: 420px;
    font-size: 11px;
  }

  .strategy-code-block code {
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }

  .strategy-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .backtest-gate-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .paper-promotion-panel {
    grid-template-columns: 1fr;
  }

  .paper-execution-grid {
    grid-template-columns: 1fr;
  }

  .paper-session-policy {
    grid-template-columns: 1fr;
  }

  .data-readiness-map {
    grid-template-columns: 1fr;
  }

  .status-note {
    max-width: none;
  }

  .status-note button {
    width: 100%;
  }

  .paper-promotion-panel button {
    width: 100%;
    min-width: 0;
  }

  .promotion-action-stack {
    justify-content: stretch;
  }

  .promotion-action-stack button {
    flex: 1 1 100%;
  }

  .workflow-header,
  .approval-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .approval-grid {
    grid-template-columns: 1fr;
  }

  .approval-actions button {
    width: 100%;
  }

  .backtest-detail-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .backtest-detail-item small {
    grid-column: auto;
  }

  .instance-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .data-table-head {
    display: none;
  }

  .strategy-event-head {
    display: none;
  }

  .backtest-run-head {
    display: none;
  }

  .data-table {
    overflow-x: visible;
  }

  .strategy-event-table {
    overflow-x: visible;
  }

  .backtest-run-table {
    overflow-x: visible;
  }

  .data-table-row {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .strategy-event-row {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .data-table-row span,
  .strategy-event-row > span {
    display: grid;
    grid-template-columns: minmax(92px, 0.34fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  .data-table-row span::before,
  .strategy-event-row > span::before {
    display: block;
    color: var(--muted);
    content: attr(data-label);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .backtest-run-row {
    grid-template-columns: 1fr;
    min-width: 0;
    gap: 8px;
  }

  .backtest-run-row > span {
    display: grid;
    grid-template-columns: minmax(88px, 0.34fr) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
  }

  .backtest-run-row > span::before {
    display: block;
    color: var(--muted);
    content: attr(data-label);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .backtest-run-row .compact-action {
    width: 100%;
  }

  .backtest-progress-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .route-loading {
    align-items: flex-start;
    padding: 18px;
  }

  .confirm-overlay {
    align-items: end;
    padding: 14px;
  }

  .confirm-dialog {
    padding: 20px;
  }

  .confirm-header h2 {
    font-size: 22px;
  }

  .confirm-details div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .confirm-actions {
    display: grid;
  }

  .confirm-actions button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .topbar {
    gap: 14px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 12px;
  }

  .brand strong {
    font-size: 14px;
  }

  .content {
    padding: 18px 12px 32px;
  }

  .page-heading h1,
  .hero h1 {
    font-size: 28px;
  }

  .tile,
  .panel {
    padding: 15px;
  }

  .tile strong {
    font-size: 24px;
  }

  .route-loading {
    flex-direction: column;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .route-loading::after,
  .route-spinner,
  .spinner,
  .confirm-overlay,
  .confirm-dialog {
    animation: none;
  }
}


/* Broker connection CRUD */
.broker-form-panel {
  max-width: 760px;
}

.broker-toolbar {
  margin-top: 18px;
}

.compact-button {
  flex: 0 1 auto;
  min-width: 120px;
}

.broker-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
}

.broker-card {
  display: grid;
  gap: 14px;
}

.broker-card-header strong {
  font-size: 22px;
}

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

.broker-meta-grid > div {
  min-width: 0;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 10px 12px;
}

.broker-meta-grid span,
.broker-meta-grid strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.broker-meta-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.broker-meta-grid strong {
  margin-top: 4px;
  font-size: 16px;
}

.broker-status-line {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.broker-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.broker-checks span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  padding: 5px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
}

.broker-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.broker-actions button {
  min-width: 0;
}

.status-good {
  color: var(--success);
}

.status-warn {
  color: #9a6b12;
}

.status-bad {
  color: var(--danger);
}

@media (max-width: 760px) {
  .broker-meta-grid,
  .broker-actions {
    grid-template-columns: 1fr;
  }
}
