:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #05070f;
  --card: #0f172a;
  --line: #243044;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --green: #16a34a;
  --amber: #f59e0b;
  --cyan: #38bdf8;
  --shell-pad: clamp(10px, 2vw, 20px);
  --shell-gap: clamp(12px, 2vw, 20px);
  --rail-width: clamp(180px, 18vw, 220px);
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #17233d, var(--bg) 45%);
  color: var(--text);
  font-size: 18px;
}

input,
select,
textarea,
button,
table {
  font-size: 1rem;
}

.app-shell {
  display: block;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  padding: var(--shell-pad);
}

.strategy-rail {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--card) 92%, black);
  padding: 18px 14px;
  position: fixed;
  top: var(--shell-pad);
  left: var(--shell-pad);
  width: var(--rail-width);
  max-height: calc(100vh - (var(--shell-pad) * 2));
  overflow-y: auto;
}

.strategy-rail__title {
  margin-bottom: 12px;
  color: #cbd5e1;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.strategy-rail__buttons {
  display: grid;
  gap: 8px;
}

.strategy-button {
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(2, 6, 23, 0.6);
  color: #cbd5e1;
  text-align: left;
}

.strategy-button:hover {
  background: rgba(15, 23, 42, 0.95);
}

.strategy-button.is-active {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.15);
  color: #e0f2fe;
}

.workspace {
  display: grid;
  gap: 20px;
  min-width: 0;
  margin-left: calc(var(--rail-width) + var(--shell-gap));
}

.card {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--card) 92%, black);
  padding: 24px;
}

.auth-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.eyebrow {
  margin: 0;
  color: var(--cyan);
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 8px 0;
}

h1 {
  font-size: 32px;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 22px;
}

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

.metric-list {
  margin-top: 20px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.metric-list div {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.6);
  padding: 12px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 6px;
}

.auth-form,
.strategy-form {
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 16px;
  color: var(--muted);
}

.field input,
.field select,
.model-params {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: rgba(2, 6, 23, 0.75);
  color: var(--text);
}

.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%), linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.field select option {
  background: #0b1222;
  color: #e2e8f0;
}

.field input:focus,
.field select:focus,
.model-params:focus {
  outline: 2px solid rgba(56, 189, 248, 0.6);
  outline-offset: 1px;
}

.two-col-grid {
  margin-top: 12px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
}

.section-title {
  margin-top: 16px;
  margin-bottom: 10px;
  font-size: 18px;
  color: #cbd5e1;
}

.date-flow {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.date-flow__group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.4);
  padding: 10px;
}

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

.model-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.5);
  padding: 10px;
}

.model-card label {
  display: block;
  margin-bottom: 8px;
  font-size: 17px;
}

.model-params {
  min-height: 62px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  resize: vertical;
}

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

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

.month-grid label {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.5);
  font-size: 15px;
}

.indicators-grid label {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(15, 23, 42, 0.5);
  font-size: 15px;
}

.form-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.form-actions--compact {
  margin-top: 6px;
}

button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary-button {
  background: #0284c7;
}

.secondary-button {
  border-color: #475569;
  background: transparent;
}

.status-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.error-text {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 10px;
  background: rgba(127, 29, 29, 0.25);
  color: #fecaca;
  font-size: 16px;
}

.pill {
  align-self: flex-start;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}

.pill--green {
  background: rgba(22, 163, 74, 0.22);
  color: #bbf7d0;
}

.pill--amber {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
}

.results-block {
  margin-top: 18px;
}

.prediction-summary {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin: 8px 0 10px;
}

.summary-chip {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  padding: 8px 10px;
  font-size: 15px;
}

.progress-wrap {
  margin-top: 12px;
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.3);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0ea5e9, #22d3ee);
  transition: width 0.3s ease;
}

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.table-wrap th,
.table-wrap td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  text-align: left;
  padding: 8px 10px;
  white-space: nowrap;
}

.table-wrap th {
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.85);
}

.pnl-pos {
  color: #86efac;
  font-weight: 600;
}

.pnl-neg {
  color: #fca5a5;
  font-weight: 600;
}

.side-badge {
  display: inline-block;
  min-width: 64px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.side-buy {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(20, 83, 45, 0.35);
}

.side-sell {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(127, 29, 29, 0.3);
}

.side-neutral {
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(120, 53, 15, 0.3);
}

.suggestion-list {
  margin: 0;
  padding-left: 18px;
  color: #cbd5e1;
  display: grid;
  gap: 8px;
}

.charts-grid {
  display: grid;
  gap: 14px;
}

.chart-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.5);
}

.chart-card canvas {
  width: 100%;
  height: auto;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.6);
}

.is-hidden {
  display: none;
}

@media (max-width: 960px) {
  .app-shell {
    display: grid;
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .strategy-rail {
    order: 2;
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
  }

  .workspace {
    margin-left: 0;
  }

  .card {
    padding: 16px;
    border-radius: 16px;
  }
}

@media (max-width: 640px) {
  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 23px;
  }

  h3 {
    font-size: 20px;
  }
}
