:root {
  color: #f8eef9;
  background: #130019;
  font-family: Poppins, "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  font-synthesis: none;
  line-height: 1.35;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
}

.auth-shell {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100dvh;
  padding: 1rem;
  background:
    linear-gradient(180deg, rgba(71, 16, 87, 0.9), rgba(19, 0, 25, 0.98) 42%, #0d0013 100%),
    linear-gradient(105deg, rgba(118, 31, 128, 0.36), rgba(236, 74, 170, 0.16) 44%, rgba(0, 0, 0, 0) 72%),
    #130019;
}

.auth-panel {
  display: grid;
  gap: 1.05rem;
  width: min(100%, 27rem);
  padding: 1.2rem;
  border: 1px solid rgba(248, 238, 249, 0.22);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(42, 9, 54, 0.94), rgba(20, 1, 29, 0.96));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42), 0 0 42px rgba(178, 40, 151, 0.18);
}

.auth-panel p,
.auth-panel h1 {
  margin: 0;
}

.auth-panel p {
  color: rgba(248, 238, 249, 0.78);
  font-weight: 700;
}

.auth-panel h1 {
  color: #f9e7ff;
  font-size: 1.9rem;
  letter-spacing: 0;
}

.auth-form {
  display: grid;
  gap: 0.85rem;
}

.auth-form label {
  display: grid;
  gap: 0.35rem;
  color: #f8eef9;
  font-weight: 800;
}

.auth-form input {
  min-width: 0;
  min-height: 2.65rem;
  padding: 0.58rem 0.72rem;
  border: 1px solid rgba(248, 238, 249, 0.24);
  border-radius: 6px;
  background: rgba(10, 0, 16, 0.74);
  color: #f9e7ff;
}

.auth-form .button--primary {
  min-height: 2.7rem;
  border-color: rgba(255, 171, 239, 0.58);
  background: linear-gradient(180deg, #9c3aa5, #742783);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(171, 55, 165, 0.34);
}

button,
input,
select {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.run-graph-node:focus-visible {
  outline: 3px solid #ffd166;
  outline-offset: 3px;
}

button,
select,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.backtest-app {
  display: grid;
  grid-template-columns: minmax(22rem, 30rem) minmax(0, 1fr);
  gap: 0.9rem;
  width: 100%;
  height: 100dvh;
  padding: 0.9rem;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(11, 28, 46, 0.96), rgba(7, 16, 26, 1)),
    #07101a;
}

.command-surface,
.results-panel,
.empty-results {
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(119, 163, 205, 0.24);
  border-radius: 8px;
  background: rgba(9, 20, 34, 0.88);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
}

.command-surface {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 0.9rem;
  overflow: hidden;
}

.results-panel,
.empty-results {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  overflow: auto;
}

.app-header,
.section-header,
.modal-header,
.modal-footer,
.progress-panel,
.selected-dataset {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.app-header {
  align-items: flex-start;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid rgba(127, 169, 210, 0.18);
}

.app-header p,
.modal-header p,
.section-header p,
.empty-results p,
.visual-gallery p,
.selected-list p {
  margin: 0;
  color: #9db0c4;
}

.app-header h1,
.section-header h2,
.section-header h3,
.empty-results h2,
.modal-header h2,
.run-table h3,
.issue-panel h3 {
  margin: 0;
  color: #ffffff;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: 1.9rem;
  line-height: 1;
}

.header-actions,
.modal-footer {
  flex-wrap: wrap;
}

.button {
  min-height: 2.35rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 800;
}

.button--primary {
  border-color: #59a7f8;
  background: #1f78d1;
  color: #ffffff;
}

.button--secondary {
  border-color: rgba(138, 173, 204, 0.42);
  background: rgba(25, 45, 67, 0.95);
  color: #dcecff;
}

.icon-button {
  width: 2rem;
  height: 2rem;
  border: 1px solid rgba(138, 173, 204, 0.36);
  border-radius: 6px;
  background: rgba(19, 35, 53, 0.96);
  color: #ffffff;
  font-weight: 900;
}

.notice {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(121, 172, 217, 0.32);
  border-radius: 6px;
  background: rgba(18, 43, 66, 0.75);
  color: #d9ecff;
}

.notice--error {
  border-color: rgba(255, 122, 140, 0.48);
  background: rgba(84, 28, 38, 0.72);
  color: #ffdfe4;
}

.selection-panel,
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.metric-card {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid rgba(109, 156, 199, 0.22);
  border-radius: 7px;
  background: rgba(12, 30, 48, 0.82);
}

.metric-card span {
  color: #93a8bd;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  overflow-wrap: anywhere;
  color: #ffffff;
  font-size: 1.1rem;
}

.selected-list {
  display: grid;
  gap: 0.5rem;
  min-height: 0;
  overflow: auto;
}

.selected-dataset {
  padding: 0.65rem;
  border: 1px solid rgba(109, 156, 199, 0.2);
  border-radius: 7px;
  background: rgba(6, 17, 29, 0.76);
}

.selected-dataset strong,
.selected-dataset span {
  display: block;
}

.selected-dataset strong {
  color: #ffffff;
}

.selected-dataset span {
  color: #9eb2c7;
  font-size: 0.82rem;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.55rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid rgba(133, 174, 214, 0.32);
  border-radius: 999px;
  color: #d5e7f7;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pill--target,
.status--success {
  border-color: rgba(95, 221, 169, 0.48);
  background: rgba(19, 86, 60, 0.55);
  color: #bdf8df;
}

.status--warning {
  border-color: rgba(255, 182, 91, 0.5);
  background: rgba(98, 63, 15, 0.58);
  color: #ffe2b5;
}

.status--danger {
  border-color: rgba(255, 122, 140, 0.52);
  background: rgba(90, 31, 42, 0.65);
  color: #ffdce3;
}

.status--muted {
  border-color: rgba(147, 166, 186, 0.34);
  background: rgba(34, 48, 64, 0.68);
  color: #d1dce8;
}

.progress-panel {
  padding: 0.7rem;
  border: 1px solid rgba(87, 156, 225, 0.32);
  border-radius: 7px;
  background: rgba(14, 38, 64, 0.78);
}

.progress-panel div {
  display: grid;
  gap: 0.12rem;
}

.progress-panel strong {
  color: #ffffff;
}

.progress-panel span {
  color: #91a6ba;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

progress {
  width: min(18rem, 100%);
  height: 0.7rem;
  accent-color: #4ea1ff;
}

.issue-panel,
.no-candidate-panel,
.run-table,
.experiment-panel,
.run-graph-panel,
.visual-gallery {
  display: grid;
  gap: 0.6rem;
}

.diagnostic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: 0.55rem;
}

.diagnostic-card,
.diagnostic-list article {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid rgba(147, 166, 186, 0.28);
  border-radius: 7px;
  background: rgba(12, 30, 48, 0.78);
}

.diagnostic-card span,
.diagnostic-list span {
  color: #8fa6bc;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.diagnostic-card strong,
.diagnostic-list strong,
.diagnostic-list h4 {
  margin: 0;
  color: #ffffff;
}

.diagnostic-card p,
.diagnostic-card small,
.diagnostic-list p {
  margin: 0;
  overflow-wrap: anywhere;
}

.diagnostic-card p,
.diagnostic-list p {
  color: #b6c7d8;
  font-size: 0.82rem;
}

.diagnostic-card small {
  color: #91a6ba;
  font-size: 0.76rem;
}

.diagnostic-list {
  display: grid;
  gap: 0.45rem;
}

.run-graph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: 0.55rem;
}

.run-graph-node {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem 0.6rem;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid rgba(113, 156, 198, 0.24);
  border-radius: 7px;
  background: rgba(10, 27, 44, 0.78);
}

.run-graph-node > div {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.run-graph-node > div span {
  color: #8fa6bc;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.run-graph-node strong {
  overflow-wrap: anywhere;
  color: #ffffff;
}

.run-graph-node p,
.run-graph-node small {
  grid-column: 1 / -1;
  margin: 0;
  overflow-wrap: anywhere;
}

.run-graph-node p {
  color: #b6c7d8;
  font-size: 0.82rem;
}

.run-graph-node small {
  color: #8298af;
  font-size: 0.72rem;
  font-weight: 800;
}

.run-graph-node--completed {
  border-color: rgba(95, 221, 169, 0.3);
}

.run-graph-node--partial,
.run-graph-node--running,
.run-graph-node--queued {
  border-color: rgba(255, 182, 91, 0.34);
}

.run-graph-node--blocked,
.run-graph-node--failed_safely {
  border-color: rgba(255, 122, 140, 0.42);
}

.run-graph-node--no_result,
.run-graph-node--unknown {
  border-color: rgba(147, 166, 186, 0.28);
}

.experiment-grid {
  display: grid;
  gap: 0.5rem;
}

.experiment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.65rem;
  border: 1px solid rgba(109, 156, 199, 0.22);
  border-radius: 7px;
  background: rgba(12, 30, 48, 0.74);
}

.experiment-row div {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.experiment-row strong {
  color: #ffffff;
}

.experiment-row span {
  overflow-wrap: anywhere;
  color: #9db0c4;
  font-size: 0.78rem;
}

.issue-panel article {
  display: grid;
  gap: 0.2rem;
  padding: 0.65rem;
  border: 1px solid rgba(255, 182, 91, 0.34);
  border-radius: 7px;
  background: rgba(71, 45, 14, 0.52);
}

.issue-panel strong {
  color: #fff1d7;
}

.issue-panel span,
.issue-panel p {
  margin: 0;
  color: #e8cda6;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

th,
td {
  padding: 0.55rem;
  border-bottom: 1px solid rgba(122, 160, 195, 0.18);
  text-align: left;
  vertical-align: top;
}

th {
  color: #b9cce0;
  font-size: 0.72rem;
  text-transform: uppercase;
}

td {
  color: #dce8f2;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(1, 5, 10, 0.74);
}

.modal {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  width: min(64rem, 96vw);
  max-height: min(44rem, 92dvh);
  padding: 0.9rem;
  border: 1px solid rgba(126, 171, 214, 0.34);
  border-radius: 8px;
  background: #0a1726;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.52);
}

.modal--settings {
  width: min(48rem, 96vw);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.search-field,
.field,
.checkbox-field {
  display: grid;
  gap: 0.3rem;
  color: #b8cce0;
  font-size: 0.82rem;
  font-weight: 800;
}

.field input,
.field select,
.search-field input {
  width: 100%;
  min-height: 2.35rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(125, 165, 205, 0.36);
  border-radius: 6px;
  background: #07101a;
  color: #ffffff;
}

.checkbox-field {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  align-self: end;
  min-height: 2.35rem;
}

.checkbox-field input {
  width: 1.1rem;
  height: 1.1rem;
}

.dataset-table-shell {
  min-height: 18rem;
  overflow: auto;
  border: 1px solid rgba(122, 160, 195, 0.18);
  border-radius: 7px;
}

.dataset-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: #9fb2c6;
  font-size: 0.82rem;
  font-weight: 800;
}

.dataset-table-shell strong,
.dataset-table-shell span {
  display: block;
}

.dataset-table-shell span {
  color: #91a7bc;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  overflow: auto;
}

.evidence-figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(119, 163, 205, 0.24);
  border-radius: 8px;
  background: rgba(5, 13, 23, 0.78);
}

.evidence-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #06101d;
}

.evidence-figure figcaption {
  display: grid;
  gap: 0.18rem;
  padding: 0.65rem 0.75rem;
}

.evidence-figure figcaption strong {
  color: #ffffff;
}

.evidence-figure figcaption span {
  color: #9fb2c6;
}

.framework-audit-app {
  display: grid;
  grid-template-columns: minmax(24rem, 34rem) minmax(0, 1fr);
  gap: 0.9rem;
  width: 100%;
  height: 100dvh;
  padding: 0.9rem;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(6, 33, 42, 0.98), rgba(6, 18, 30, 1)),
    #06121e;
}

.audit-command-surface,
.audit-results-panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(106, 177, 185, 0.28);
  border-radius: 8px;
  background: rgba(7, 24, 36, 0.9);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
}

.audit-command-surface {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0.9rem;
  overflow: auto;
}

.audit-results-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  overflow: auto;
}

.framework-audit-form,
.audit-result-shell,
.audit-report,
.result-file-viewer,
.pillar-selector,
.scorecard-grid,
.artifact-list {
  display: grid;
  gap: 0.75rem;
}

.field-group,
.segmented-fieldset,
.pillar-selector {
  min-width: 0;
  margin: 0;
  padding: 0.75rem;
  border: 1px solid rgba(117, 180, 190, 0.22);
  border-radius: 7px;
  background: rgba(4, 16, 27, 0.66);
}

.field-group {
  display: grid;
  gap: 0.45rem;
}

.field-group span,
.segmented-fieldset legend,
.pillar-selector legend {
  color: #e7fbff;
  font-weight: 900;
}

.field-group input[type="file"] {
  width: 100%;
  min-width: 0;
  color: #cfe7ee;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.segmented-control label,
.pillar-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.58rem 0.65rem;
  border: 1px solid rgba(107, 169, 184, 0.24);
  border-radius: 6px;
  background: rgba(8, 28, 43, 0.78);
}

.segmented-control label:has(input:checked),
.pillar-option:has(input:checked) {
  border-color: rgba(99, 220, 194, 0.48);
  background: rgba(17, 73, 70, 0.62);
}

.pillar-option span,
.pillar-option strong,
.pillar-option small {
  display: block;
  min-width: 0;
}

.pillar-option strong {
  color: #ffffff;
}

.pillar-option small {
  overflow-wrap: anywhere;
  color: #a7c2cc;
}

.audit-submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.7rem;
  color: #a7c2cc;
  font-weight: 800;
}

.audit-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.audit-tab {
  min-height: 2.25rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(117, 180, 190, 0.26);
  border-radius: 6px;
  background: rgba(8, 28, 43, 0.78);
  color: #d4edf4;
  font-weight: 900;
}

.audit-tab--active {
  border-color: rgba(99, 220, 194, 0.56);
  background: rgba(18, 87, 81, 0.7);
  color: #ffffff;
}

.audit-report article,
.result-file-viewer article,
.scorecard,
.artifact-list article,
.fix-row {
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid rgba(117, 180, 190, 0.22);
  border-radius: 7px;
  background: rgba(6, 20, 32, 0.78);
}

.audit-report h3,
.scorecard h3 {
  margin: 0;
  color: #ffffff;
  letter-spacing: 0;
}

.audit-report p,
.scorecard p,
.fix-row p {
  margin: 0;
  color: #b8d2dc;
}

.audit-definition-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0.7rem 0 0;
}

.audit-definition-list div {
  min-width: 0;
  padding: 0.55rem;
  border: 1px solid rgba(117, 180, 190, 0.18);
  border-radius: 6px;
  background: rgba(2, 12, 21, 0.72);
}

.audit-definition-list dt {
  color: #90b6c1;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.audit-definition-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: #ffffff;
  font-weight: 800;
}

.compact-list {
  display: grid;
  gap: 0.4rem;
  margin: 0.65rem 0 0;
  padding-left: 1.2rem;
  color: #c5dde6;
}

.fix-row {
  display: grid;
  gap: 0.3rem;
}

.fix-row strong {
  color: #ffffff;
}

.fix-row span {
  width: fit-content;
  padding: 0.16rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 182, 91, 0.16);
  color: #ffe0ad;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.scorecard-grid {
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.framework-run-result__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  min-height: 2.2rem;
  border: 1px solid rgba(99, 220, 194, 0.48);
  border-radius: 6px;
  background: rgba(17, 73, 70, 0.62);
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 900;
}

.artifact-list article {
  display: grid;
  gap: 0.45rem;
}

.artifact-list strong,
.artifact-list span {
  display: block;
}

.artifact-list strong {
  color: #ffffff;
}

.artifact-list span {
  color: #a7c2cc;
}

.artifact-list code,
.raw-json {
  min-width: 0;
  overflow-wrap: anywhere;
  border: 1px solid rgba(117, 180, 190, 0.2);
  border-radius: 6px;
  background: rgba(2, 10, 18, 0.82);
  color: #dffaff;
}

.artifact-list code {
  padding: 0.45rem;
}

.raw-json {
  overflow: auto;
  padding: 0.75rem;
  white-space: pre-wrap;
}

.result-file-viewer article {
  display: grid;
  gap: 0.75rem;
}

.result-file-viewer h3,
.result-file-viewer p {
  margin: 0;
}

.result-file-viewer h3 {
  color: #ffffff;
  letter-spacing: 0;
}

.result-file-viewer p {
  color: #b8d2dc;
}

.result-file-preview {
  min-height: 18rem;
  max-height: 48rem;
  margin: 0;
  overflow: auto;
  padding: 0.75rem;
  border: 1px solid rgba(117, 180, 190, 0.2);
  border-radius: 6px;
  background: rgba(2, 10, 18, 0.82);
  color: #dffaff;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .backtest-app,
  .framework-audit-app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .command-surface,
  .results-panel,
  .empty-results,
  .audit-command-surface,
  .audit-results-panel {
    overflow: visible;
  }

  .selection-panel,
  .metrics-grid,
  .settings-grid,
  .segmented-control,
  .audit-definition-list {
    grid-template-columns: 1fr;
  }
}
