:root {
  color-scheme: light;
  --bg: #eef3f8;
  --bg-deep: #dfe8f1;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-strong: #f8fbfe;
  --line: rgba(42, 62, 88, 0.12);
  --text: #102033;
  --muted: #55657a;
  --primary: #2048ff;
  --primary-soft: rgba(32, 72, 255, 0.12);
  --accent: #00a676;
  --danger: #c0392b;
  --warning: #ad6800;
  --shadow: 0 20px 55px rgba(19, 38, 65, 0.12);
  --shadow-soft: 0 12px 28px rgba(19, 38, 65, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font: "Aptos", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(32, 72, 255, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(0, 166, 118, 0.10), transparent 26%),
    linear-gradient(180deg, var(--bg), #f7fafc 55%, #f1f6fb);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.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;
}

.backdrop {
  position: fixed;
  inset: auto;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(30px);
  opacity: 0.75;
}

.backdrop-a {
  top: -80px;
  left: -60px;
  width: 280px;
  height: 280px;
  background: rgba(32, 72, 255, 0.16);
}

.backdrop-b {
  top: 90px;
  right: -90px;
  width: 340px;
  height: 340px;
  background: rgba(0, 166, 118, 0.12);
}

.app-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
  padding: 6px 2px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.1rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: -0.06em;
}

.lede {
  margin: 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.status-stack {
  min-width: 220px;
  text-align: right;
  display: grid;
  gap: 10px;
  justify-items: end;
}

.logout-form {
  margin: 0;
}

.logout-button {
  padding-inline: 16px;
}

.status-pill {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  font-weight: 700;
}

.status-pill[data-state="ok"] {
  color: var(--accent);
}

.status-pill[data-state="warn"] {
  color: var(--warning);
}

.status-pill[data-state="error"] {
  color: var(--danger);
}

.status-note,
.inline-status,
.muted,
.mini-copy {
  color: var(--muted);
}

.automation-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

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

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

.automation-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(42, 62, 88, 0.08);
  background: rgba(255, 255, 255, 0.7);
  display: grid;
  gap: 8px;
}

.automation-value {
  font-size: 1.04rem;
  line-height: 1.25;
}

#auto-train-enabled[data-state="ok"] {
  color: var(--accent);
}

#auto-train-enabled[data-state="warn"] {
  color: var(--warning);
}

.automation-footer {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.panel,
.pair-card,
.modal-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel {
  padding: 20px;
}

.panel-head,
.card-top,
.card-footer,
.section-head,
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.panel-head p,
.section-head .mini-copy,
.card-market,
.card-updated,
.modal-subtitle {
  margin-bottom: 0;
}

.panel-head h2,
.section-head h3 {
  margin-bottom: 6px;
}

.search-panel {
  display: grid;
  gap: 14px;
}

.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  padding: 14px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.search-input:focus {
  outline: 2px solid rgba(32, 72, 255, 0.25);
  border-color: rgba(32, 72, 255, 0.4);
}

.search-results {
  display: grid;
  gap: 10px;
}

.search-result {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: var(--surface-strong);
}

.search-result:hover {
  border-color: rgba(32, 72, 255, 0.18);
}

.watchlist-panel {
  display: grid;
  gap: 14px;
}

.watchlist {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.watch-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.watch-chip button {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(16, 32, 51, 0.08);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
}

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

.positions-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

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

.pair-card {
  padding: 18px;
  display: grid;
  gap: 16px;
  min-height: 100%;
}

.card-symbol {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ghost-button,
.primary-button,
.icon-button {
  border-radius: 999px;
  padding: 10px 14px;
  transition:
    transform 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  color: var(--text);
}

.ghost-button:hover,
.primary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, var(--primary), #325aff);
  color: #fff;
  box-shadow: 0 14px 26px rgba(32, 72, 255, 0.22);
}

.icon-button {
  background: rgba(16, 32, 51, 0.08);
  color: var(--text);
}

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

.metric {
  background: rgba(255, 255, 255, 0.68);
  border-radius: 18px;
  border: 1px solid rgba(42, 62, 88, 0.08);
  padding: 12px;
  min-height: 76px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.metric-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-value {
  font-size: 1.08rem;
  line-height: 1.25;
}

.metrics-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metric-chip {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(16, 32, 51, 0.06);
  color: var(--muted);
  font-size: 0.86rem;
}

.metric-chip[data-variant="positive"] {
  color: #0b6d4a;
  background: rgba(0, 166, 118, 0.12);
}

.metric-chip[data-variant="negative"] {
  color: var(--danger);
  background: rgba(192, 57, 43, 0.12);
}

.freshness-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
}

.freshness-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(16, 32, 51, 0.06);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.freshness-pill[data-variant="positive"] {
  color: #0b6d4a;
  background: rgba(0, 166, 118, 0.12);
}

.freshness-pill[data-variant="warning"] {
  color: var(--warning);
  background: rgba(173, 104, 0, 0.14);
}

.freshness-pill[data-variant="muted"] {
  color: var(--muted);
}

.card-state {
  font-weight: 700;
}

.card-market,
.prediction-timestamps {
  min-height: 1.2em;
}

.pair-card[data-state="loading"] {
  opacity: 0.82;
}

.pair-card[data-state="error"] .card-state {
  color: var(--danger);
}

.inline-status {
  font-size: 0.92rem;
}

.positions-list {
  display: grid;
  gap: 12px;
}

.position-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(42, 62, 88, 0.08);
}

.position-card-top,
.position-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.position-symbol {
  font-size: 1.02rem;
  font-weight: 800;
}

.position-direction {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(16, 32, 51, 0.06);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.position-direction[data-direction="long"] {
  color: #0b6d4a;
  background: rgba(0, 166, 118, 0.12);
}

.position-direction[data-direction="short"] {
  color: var(--warning);
  background: rgba(173, 104, 0, 0.12);
}

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

.position-metric {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(42, 62, 88, 0.08);
}

.position-value {
  font-size: 1rem;
  line-height: 1.25;
}

.position-value[data-variant="positive"] {
  color: #0b6d4a;
}

.position-value[data-variant="negative"] {
  color: var(--danger);
}

.position-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.position-note {
  margin: 0;
  color: var(--muted);
}

.position-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.position-form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.position-modal-panel {
  max-width: 720px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(224, 233, 241, 0.75), rgba(255, 255, 255, 0.96), rgba(224, 233, 241, 0.75));
  background-size: 220% 100%;
  animation: shimmer 1.2s linear infinite;
  color: transparent !important;
}

@keyframes shimmer {
  0% {
    background-position: 180% 0;
  }
  100% {
    background-position: -180% 0;
  }
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 30;
}

.modal.is-open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 34, 0.36);
  backdrop-filter: blur(8px);
}

.modal-panel {
  position: relative;
  width: min(1180px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  margin: 12px auto;
  padding: 18px;
  overflow: auto;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.login-shell {
  width: min(640px, calc(100vw - 24px));
  padding: 24px 0;
  position: relative;
  z-index: 1;
}

.login-card {
  padding: 28px;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  display: grid;
  gap: 18px;
}

.login-card h1 {
  margin-bottom: 0;
}

.login-form {
  display: grid;
  gap: 14px;
}

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

.field-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.login-input {
  width: 100%;
}

.login-submit {
  width: fit-content;
  min-width: 160px;
  margin-top: 4px;
}

.login-message {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(192, 57, 43, 0.10);
  border: 1px solid rgba(192, 57, 43, 0.20);
  color: var(--danger);
  line-height: 1.5;
}

.login-meta {
  margin: 0;
  color: var(--muted);
}

.modal-body {
  display: grid;
  gap: 18px;
  margin-top: 14px;
}

.modal-section {
  display: grid;
  gap: 14px;
}

.history-chart,
.history-table,
.prediction-history {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.history-chart {
  min-height: 220px;
  padding: 12px;
}

.history-table,
.prediction-history {
  overflow: auto;
}

.history-table table,
.prediction-history table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.history-table th,
.history-table td,
.prediction-history th,
.prediction-history td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(42, 62, 88, 0.08);
  text-align: left;
  white-space: nowrap;
}

.history-table th,
.prediction-history th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: rgba(16, 32, 51, 0.03);
}

.table-empty,
.empty-state {
  padding: 18px;
  color: var(--muted);
}

svg {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 1080px) {
  .page-grid,
  .cards-grid {
    grid-template-columns: 1fr;
  }

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

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

  .topbar {
    flex-direction: column;
  }

  .status-stack {
    width: 100%;
    justify-items: start;
    text-align: left;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 18px, 1280px);
    padding-top: 18px;
  }

  .panel,
  .pair-card,
  .modal-panel {
    border-radius: 22px;
  }

  .panel {
    padding: 16px;
  }

  .panel-head,
  .card-top,
  .card-footer,
  .section-head,
  .modal-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .history-table table,
  .prediction-history table {
    min-width: 540px;
  }

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

  .login-card {
    padding: 20px;
  }
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.55rem;
  text-align: left;
}

.data-table button {
  margin-right: 0.35rem;
}
