:root {
  --ink: #10233a;
  --ink-soft: #3a516b;
  --paper: #f3efe6;
  --paper-2: #e7e0d2;
  --panel: rgba(255, 252, 245, 0.86);
  --line: rgba(16, 35, 58, 0.12);
  --brass: #b08d57;
  --brass-deep: #8a6a3a;
  --sea: #1f6f6a;
  --danger: #9b3b2e;
  --ok: #2f6b4f;
  --shadow: 0 18px 50px rgba(16, 35, 58, 0.12);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.45;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(176, 141, 87, 0.28), transparent 60%),
    radial-gradient(700px 420px at 90% 0%, rgba(31, 111, 106, 0.18), transparent 55%),
    linear-gradient(160deg, #f7f2e8 0%, #e9e2d4 45%, #dfe8e4 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(16, 35, 58, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 35, 58, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.75rem 1.15rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.auth-form {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.auth-form input {
  width: 9.5rem;
  border: 1px solid var(--line);
  background: #fffdf8;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  color: var(--ink);
}

.auth-form button,
.auth-user button {
  border: 0;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  background: linear-gradient(160deg, var(--brass), var(--brass-deep));
  color: #fff8ea;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
}

.auth-form button.ghost,
.auth-user button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.auth-form[hidden],
.auth-user[hidden],
.is-hidden {
  display: none !important;
}

.auth-user em {
  font-style: normal;
  color: var(--sea);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  display: block;
  height: 5.5rem;
  width: auto;
  max-width: min(420px, 55vw);
  object-fit: contain;
}

@media (max-width: 900px) {
  .brand-logo {
    height: 3.8rem;
    max-width: min(280px, 70vw);
  }
}

.brand-mark {
  display: none;
}

.brand-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.brand-tag {
  margin: 0.1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.status-pill,
.mode-chip {
  border: 1px solid var(--line);
  background: rgba(255, 252, 245, 0.75);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill.ok {
  color: var(--ok);
  border-color: rgba(47, 107, 79, 0.35);
}

.status-pill.bad {
  color: var(--danger);
  border-color: rgba(155, 59, 46, 0.35);
}

.shell {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.25rem;
  animation: rise 0.7s ease both;
}

.hero-panel h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.03em;
}

.lede {
  margin: 0.45rem 0 0;
  max-width: 38rem;
  color: var(--ink-soft);
}

.grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1rem;
}

.span-2 {
  grid-column: 1 / -1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.3rem;
  animation: rise 0.8s ease both;
}

.panel:nth-child(2) {
  animation-delay: 0.08s;
}

.panel:nth-child(3) {
  animation-delay: 0.14s;
}

.system-panel {
  margin-bottom: 1rem;
  animation: rise 0.75s ease both;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
}

.system-card {
  background: rgba(16, 35, 58, 0.04);
  border-radius: 14px;
  padding: 0.75rem 0.8rem;
}

.system-card span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.system-card strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.98rem;
}

.system-card strong.ok {
  color: var(--ok);
}

.system-card strong.bad {
  color: var(--danger);
}

.system-detail {
  margin: 0.85rem 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  .system-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.panel-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.panel-head p {
  margin: 0.25rem 0 1rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffdf8;
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  color: var(--ink);
}

button {
  border: 0;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  background: linear-gradient(160deg, var(--brass), var(--brass-deep));
  color: #fff8ea;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 1.1rem 0;
}

.metric {
  background: rgba(16, 35, 58, 0.04);
  border-radius: 14px;
  padding: 0.75rem 0.8rem;
}

.metric span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}

.metric strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.05rem;
}

.metric strong.pos {
  color: var(--ok);
}

.metric strong.neg {
  color: var(--danger);
}

.chart-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, #16324f, #10233a);
  min-height: 280px;
}

#equityChart {
  width: 100%;
  height: auto;
  display: block;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: rgba(243, 239, 230, 0.7);
  font-size: 0.95rem;
  pointer-events: none;
}

.chart-empty.hidden {
  display: none;
}

.disclaimer {
  margin: 0.85rem 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.risk-list,
.strategy-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.risk-list li,
.strategy-card {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(16, 35, 58, 0.04);
  border: 1px solid transparent;
}

.strategy-card {
  flex-direction: column;
  align-items: start;
}

.strategy-card strong {
  font-family: var(--font-display);
}

.strategy-card span {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.sku {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sea);
}

.footer {
  text-align: center;
  padding: 0 1rem 2rem;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

@media (max-width: 900px) {
  .grid,
  .form-row,
  .metrics {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    flex-direction: column;
    align-items: start;
  }
}
