:root {
  --bg: #08141a;
  --surface: #0f232b;
  --surface-2: #173542;
  --line: #285062;
  --text: #eaf7ff;
  --muted: #9ebdce;
  --accent: #ff9f1c;
  --good: #2ec4b6;
  --bad: #ff4d6d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  background: radial-gradient(circle at 15% 15%, #18425b 0%, var(--bg) 55%);
  scroll-behavior: smooth;
  padding-top: 4.2rem;
}

.bg-blur {
  position: fixed;
  inset: -30% auto auto -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(255, 159, 28, 0.22) 0%, transparent 60%);
  filter: blur(12px);
  pointer-events: none;
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.hero-top {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  align-items: center;
  gap: 1.2rem;
}

.hero-side {
  display: grid;
  gap: 0.7rem;
}

.logo {
  width: clamp(200px, 22vw, 280px);
  min-width: 200px;
  height: auto;
  object-fit: contain;
  border-radius: 20px;
  border: 1px solid rgba(255, 159, 28, 0.4);
  background: rgba(255, 159, 28, 0.07);
  padding: 0.85rem;
  box-shadow: 0 0 28px rgba(255, 159, 28, 0.28);
}

.hero h1 {
  margin: 0.2rem 0 0.8rem;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
}

.eyebrow {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 0;
}

.pill-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid var(--line);
  background: rgba(18, 33, 28, 0.9);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
}

.grid-cards {
  margin-top: 1.2rem;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.compact-list {
  margin: 0.55rem 0 0.25rem;
  padding-left: 1rem;
  display: grid;
  gap: 0.2rem;
  font-size: 0.84rem;
}

.news-read-list {
  margin: 0.65rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.news-read-list li {
  color: var(--text);
}

.news-read-list a {
  color: var(--accent);
  text-decoration: none;
}

.news-read-list a:hover {
  text-decoration: underline;
}

.card,
.panel {
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}

.card h2,
.panel h2 {
  margin: 0;
  font-size: 1rem;
}

.metric {
  margin: 0.7rem 0 0.3rem;
  font-size: 1.5rem;
  font-weight: 700;
}

#metaModelInfo,
#metaModelLatest {
  display: block;
}

.panel {
  margin-top: 1rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

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

select {
  background: rgba(8, 20, 26, 0.7);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
}

button {
  background: var(--accent);
  color: #1e1710;
  border: 0;
  border-radius: 9px;
  padding: 0.55rem 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.03);
}

button.btn-secondary {
  background: rgba(8, 20, 26, 0.78);
  color: var(--muted);
  border: 1px solid var(--line);
}

button.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--text);
}

.feedback {
  margin: 0.8rem 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: var(--muted);
}

.feedback[data-level="success"] {
  color: var(--good);
}

.feedback[data-level="error"] {
  color: var(--bad);
}

.quick-nav {
  margin-top: 0;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.4rem;
  border: 1px solid rgba(40, 80, 98, 0.65);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(15, 35, 43, 0.78), rgba(23, 53, 66, 0.45));
  backdrop-filter: blur(4px);
  position: fixed;
  top: 0.45rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(1200px, calc(100% - 1.2rem));
  z-index: 70;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
}

.quick-nav a {
  text-decoration: none;
  color: var(--text);
  border: 1px solid rgba(40, 80, 98, 0.7);
  border-radius: 10px;
  padding: 0.4rem 0.72rem;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  font-family: "IBM Plex Mono", monospace;
  background: rgba(8, 20, 26, 0.55);
  transition: all 140ms ease;
}

.quick-nav a:hover {
  border-color: var(--accent);
  background: rgba(255, 159, 28, 0.12);
  transform: translateY(-1px);
}

.quick-nav a.active {
  border-color: var(--accent);
  background: rgba(255, 159, 28, 0.2);
  color: #fff6ea;
}

.health-grid {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.status-strip {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
  background: linear-gradient(145deg, rgba(8, 20, 26, 0.78), rgba(23, 53, 66, 0.45));
}

.status-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.status-title {
  margin: 0;
  font-weight: 700;
}

.status-hint {
  margin: 0.32rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.status-chips {
  margin-top: 0.45rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.status-pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
}

.status-pill.good {
  color: var(--good);
  border-color: rgba(46, 196, 182, 0.7);
}

.status-pill.warn {
  color: var(--accent);
  border-color: rgba(255, 159, 28, 0.7);
}

.status-pill.bad {
  color: var(--bad);
  border-color: rgba(255, 77, 109, 0.7);
}

.status-pill.info {
  color: var(--muted);
}

.risk-grid {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.risk-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: rgba(8, 20, 26, 0.55);
}

.risk-card h3 {
  margin: 0;
  font-size: 0.92rem;
}

.risk-card .metric {
  margin: 0.55rem 0 0.45rem;
  font-size: 1.1rem;
  font-family: "IBM Plex Mono", monospace;
}

.risk-track {
  margin-top: 0.2rem;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 20, 26, 0.65);
  overflow: hidden;
}

.risk-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #2ec4b6 0%, #8de7de 100%);
  transition: width 220ms ease;
}

.risk-bar.warn {
  background: linear-gradient(90deg, #ff9f1c 0%, #ffd08a 100%);
}

.risk-bar.danger {
  background: linear-gradient(90deg, #ff4d6d 0%, #ff9db0 100%);
}

.health-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: rgba(8, 20, 26, 0.55);
}

.health-card h3 {
  margin: 0;
  font-size: 0.92rem;
}

.health-span-2 {
  grid-column: span 2;
}

.health-full {
  grid-column: 1 / -1;
}

.health-checks {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.4rem;
}

.health-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.5rem;
  display: grid;
  gap: 0.2rem;
}

.health-item.alert-error {
  border-color: rgba(255, 77, 109, 0.7);
  background: rgba(255, 77, 109, 0.08);
}

.health-item.alert-warning {
  border-color: rgba(255, 159, 28, 0.7);
  background: rgba(255, 159, 28, 0.08);
}

.health-item.alert-info {
  border-color: rgba(46, 196, 182, 0.7);
  background: rgba(46, 196, 182, 0.06);
}

.health-incidents {
  margin-top: 0.6rem;
  display: grid;
  gap: 0.4rem;
}

.budget-track {
  margin-top: 0.55rem;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 20, 26, 0.65);
  overflow: hidden;
}

.budget-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #2ec4b6 0%, #8de7de 100%);
  transition: width 220ms ease;
}

.budget-bar.warn {
  background: linear-gradient(90deg, #ff9f1c 0%, #ffd08a 100%);
}

.budget-bar.danger {
  background: linear-gradient(90deg, #ff4d6d 0%, #ff9db0 100%);
}

.health-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.health-item-head span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.health-state {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
}

.health-state.ok {
  color: var(--good);
  border-color: rgba(46, 196, 182, 0.7);
}

.health-state.error {
  color: var(--bad);
  border-color: rgba(255, 77, 109, 0.7);
}

.health-state.disabled {
  color: var(--muted);
}

.health-state.partial {
  color: var(--accent);
  border-color: rgba(255, 159, 28, 0.7);
}

.health-message {
  font-size: 0.8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ai-test-grid {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.ai-test-col {
  display: grid;
  gap: 0.65rem;
}

.ai-test-col textarea {
  width: 100%;
  background: rgba(8, 20, 26, 0.7);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-family: "IBM Plex Mono", monospace;
  resize: vertical;
  min-height: 120px;
}

.ai-test-col input {
  width: 100%;
  background: rgba(8, 20, 26, 0.7);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-family: "IBM Plex Mono", monospace;
}

.ai-test-force {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}

.ai-test-output {
  margin: 0;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 20, 26, 0.62);
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  line-height: 1.5;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.app-profile-title {
  margin: 0.6rem 0 0.3rem;
}

.app-expectations {
  margin: 0.2rem 0 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.2rem;
}

.result-grid {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.84rem;
}

#kpiValidationFoldTable {
  margin-top: 0.75rem;
}

.equity-wrap {
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(8, 20, 26, 0.5);
}

#equityChart {
  width: 100%;
  height: 240px;
  display: block;
}

.table-wrap {
  margin-top: 0.8rem;
  overflow-x: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0.4rem;
  text-align: left;
  font-size: 0.85rem;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

td.code {
  font-family: "IBM Plex Mono", monospace;
  overflow-wrap: anywhere;
}

.decisions-table .col-time {
  width: 15%;
}

.decisions-table .col-symbol {
  width: 10%;
}

.decisions-table .col-action {
  width: 8%;
}

.decisions-table .col-confidence {
  width: 8%;
}

.decisions-table .col-report {
  width: 59%;
}

.decisions-table th:nth-child(3),
.decisions-table td:nth-child(3),
.decisions-table th:nth-child(4),
.decisions-table td:nth-child(4) {
  text-align: center;
}

.report {
  display: grid;
  gap: 0.42rem;
  line-height: 1.42;
}

.report .risk-inline {
  padding: 0.22rem 0.4rem;
  border: 1px solid rgba(40, 80, 98, 0.8);
  border-radius: 8px;
  background: rgba(8, 20, 26, 0.45);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
}

.decision-list {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.65rem;
}

.decision-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 20, 26, 0.55);
  padding: 0.85rem 0.9rem;
}

.decision-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.decision-meta {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  flex-wrap: wrap;
}

.mini-tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  background: rgba(8, 20, 26, 0.55);
}

.mini-tag.good {
  border-color: rgba(46, 196, 182, 0.7);
  color: var(--good);
}

.mini-tag.bad {
  border-color: rgba(255, 77, 109, 0.7);
  color: var(--bad);
}

.decision-why {
  margin-top: 0.6rem;
  font-size: 0.87rem;
}

.decision-detail {
  margin-top: 0.5rem;
}

.decision-detail > summary {
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--muted);
}

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

.report .label {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
}

.ai-exp-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  font-family: "IBM Plex Mono", monospace;
  margin-right: 0.35rem;
}

.ai-exp-badge.ok {
  color: var(--good);
  border-color: rgba(46, 196, 182, 0.7);
}

.ai-exp-badge.reused {
  color: var(--accent);
  border-color: rgba(255, 159, 28, 0.75);
}

.ai-exp-badge.skipped,
.ai-exp-badge.disabled,
.ai-exp-badge.neutral {
  color: var(--muted);
  border-color: var(--line);
}

.ai-exp-badge.fallback {
  color: #ffd08a;
  border-color: rgba(255, 208, 138, 0.8);
}

.report-list {
  margin: 0.2rem 0 0.1rem 1rem;
  padding: 0;
  display: grid;
  gap: 0.16rem;
}

.report-list li {
  font-size: 0.82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}


.setups-grid {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  width: 100%;
}

.setup-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  background: rgba(8, 20, 26, 0.55);
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 0.8rem;
  align-items: start;
}

.setup-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.setup-meta {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.setup-line {
  margin-top: 0.22rem;
  font-size: 0.84rem;
}

.setup-col {
  min-width: 0;
}

.fill-grid {
  margin-top: 0.55rem;
  display: grid;
  gap: 0.55rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.fill-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.6rem;
  background: rgba(15, 35, 43, 0.55);
}

.fill-title {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
  font-family: "IBM Plex Mono", monospace;
}

.fill-line {
  font-size: 0.82rem;
  line-height: 1.35;
  margin-top: 0.16rem;
  overflow-wrap: anywhere;
}

.setup-full {
  grid-column: 1 / -1;
}

.setup-head-badges {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge.buy {
  background: rgba(42, 157, 143, 0.2);
  color: var(--good);
}

.badge.sell {
  background: rgba(231, 111, 81, 0.2);
  color: var(--bad);
}

.badge.hold {
  background: rgba(158, 185, 174, 0.16);
  color: var(--muted);
}

.status-badge {
  display: inline-block;
  margin-left: 0.45rem;
  vertical-align: middle;
  padding: 0.2rem 0.52rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-family: "IBM Plex Mono", monospace;
  border: 1px solid transparent;
}

.status-badge.safe {
  color: var(--accent);
  background: rgba(255, 159, 28, 0.14);
  border-color: rgba(255, 159, 28, 0.55);
}

.status-badge.live {
  color: var(--good);
  background: rgba(46, 196, 182, 0.16);
  border-color: rgba(46, 196, 182, 0.6);
}

@media (max-width: 680px) {
  body {
    padding-top: 7rem;
  }

  .quick-nav {
    top: 0.2rem;
    width: calc(100% - 0.6rem);
    border-radius: 12px;
  }

  .hero-top {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .logo {
    width: min(80vw, 260px);
    min-width: 200px;
    height: auto;
  }

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

  .health-span-2 {
    grid-column: auto;
  }
}
