/* /staking stake cabinet — page-scoped via body.page-staking */

body.page-staking .stake-page-intro {
  margin: 0 0 12px;
  max-width: 52rem;
}

body.page-staking .stake-page-lead {
  margin: 6px 0 0;
  color: rgba(148, 163, 184, 0.9);
  font-size: 14px;
  line-height: 1.45;
}

body.page-staking .stake-cabinet {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  /* Match /autotrade mobile/native shell; desktop hug is scoped below */
  flex: 1 1 auto;
}

/* Desktop only: cabinet height follows content (SEO sits under taller column) */
@media (min-width: 1024px) {
  body.page-staking .stake-cabinet {
    flex: 0 0 auto;
    height: auto;
  }
}

body.page-staking .stake-card {
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.1), rgba(2, 6, 23, 0.22) 60%);
  padding: 14px 14px 12px;
  box-sizing: border-box;
  min-width: 0;
}

body.page-staking .stake-card-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.92);
}

/* Balance row: JupSOL | ≈ | SOL + USD (equal columns, vertically centered) */
body.page-staking .stake-hero-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  column-gap: 10px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

body.page-staking .stake-hero-amount {
  margin: 0;
  min-width: 0;
  justify-self: start;
  font-size: clamp(18px, 2.8vw, 24px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #e2e8f0;
  line-height: 1.2;
  overflow-wrap: break-word;
  word-break: normal;
}

body.page-staking .stake-hero-approx {
  justify-self: center;
  flex: 0 0 auto;
  font-size: clamp(18px, 2.6vw, 24px);
  font-weight: 600;
  line-height: 1;
  color: rgba(148, 163, 184, 0.85);
  user-select: none;
}

body.page-staking .stake-hero-values {
  min-width: 0;
  justify-self: end;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

body.page-staking .stake-hero-sol {
  font-size: clamp(13px, 1.8vw, 16px);
  font-weight: 600;
  line-height: 1.25;
  color: rgba(203, 213, 225, 0.88);
  overflow-wrap: break-word;
  word-break: normal;
}

body.page-staking .stake-hero-usd {
  margin: 0;
  font-size: clamp(11px, 1.4vw, 13px);
  font-weight: 500;
  line-height: 1.25;
  color: rgba(148, 163, 184, 0.72);
  overflow-wrap: break-word;
  word-break: normal;
}

body.page-staking .stake-hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(148, 163, 184, 0.82);
}

body.page-staking .stake-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

body.page-staking .stake-metric {
  min-width: 0;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.45);
}

body.page-staking .stake-metric-label {
  display: block;
  font-size: 11px;
  color: rgba(148, 163, 184, 0.85);
  margin-bottom: 4px;
}

body.page-staking .stake-metric-value {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
  word-break: break-word;
}

body.page-staking .stake-metric-sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: rgba(148, 163, 184, 0.75);
}

body.page-staking .stake-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.page-staking .stake-action-btn {
  appearance: none;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(14, 165, 233, 0.12);
  color: #e0f2fe;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  min-height: 44px;
  flex: 1 1 auto;
}

body.page-staking .stake-action-btn:hover {
  border-color: rgba(56, 189, 248, 0.55);
}

body.page-staking .stake-action-btn.is-active {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.45);
}

body.page-staking .stake-market-note {
  margin: 0;
  font-size: 12px;
  color: rgba(148, 163, 184, 0.8);
  line-height: 1.4;
}

body.page-staking .stake-calc-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

body.page-staking .stake-calc-input {
  flex: 1 1 140px;
  min-width: 0;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(2, 6, 23, 0.55);
  color: #e2e8f0;
  font: inherit;
  font-size: 15px;
  padding: 10px 12px;
  box-sizing: border-box;
}

body.page-staking .stake-chip {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.6);
  color: #cbd5e1;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 36px;
}

body.page-staking .stake-forecast-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

body.page-staking .stake-forecast-item {
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.4);
}

body.page-staking .stake-chart-wrap {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

body.page-staking .stake-chart-wrap.is-empty {
  min-height: 0 !important;
  height: auto !important;
}

body.page-staking .stake-chart-wrap.is-empty svg,
body.page-staking .stake-card[data-stake-section="chart"].is-empty .stake-chart-svg {
  display: none !important;
  height: 0 !important;
}

/* Hide empty chart entirely — no “not enough history” placeholder card */
body.page-staking .stake-card[data-stake-section="chart"].is-empty {
  display: none;
}

body.page-staking .stake-metrics-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 420px) {
  body.page-staking .stake-metrics-compact {
    grid-template-columns: 1fr;
  }
}

body.page-staking .stake-chart-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

body.page-staking .stake-chart-tab {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: transparent;
  color: #94a3b8;
  font: inherit;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

body.page-staking .stake-chart-tab.is-active {
  color: #e2e8f0;
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.1);
}

body.page-staking .stake-chart-svg {
  width: 100%;
  height: 140px;
  display: block;
}

body.page-staking .stake-empty {
  margin: 0;
  font-size: 13px;
  color: rgba(148, 163, 184, 0.85);
  line-height: 1.4;
}

body.page-staking .stake-history-scroll {
  min-width: 0;
}

body.page-staking .stake-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.page-staking .stake-history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.4);
  min-width: 0;
}

body.page-staking .stake-history-type {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
}

body.page-staking .stake-history-meta {
  font-size: 12px;
  color: rgba(148, 163, 184, 0.85);
  word-break: break-word;
}

body.page-staking .stake-history-link {
  color: #38bdf8;
  font-size: 12px;
  text-decoration: none;
}

body.page-staking .stake-status {
  font-size: 13px;
  color: rgba(148, 163, 184, 0.9);
}

@media (min-width: 900px) {
  body.page-staking .stake-metrics:not(.stake-metrics-compact) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Desktop density: tighter cards, full chart height, history inner scroll when long */
@media (min-width: 1024px) {
  body.page-staking .stake-page-intro {
    margin: 0 0 8px;
  }

  body.page-staking .stake-page-lead {
    margin: 4px 0 0;
    font-size: 13px;
  }

  body.page-staking .stake-cabinet {
    gap: 10px;
  }

  body.page-staking .stake-card {
    padding: 12px 12px 10px;
    border-radius: 12px;
  }

  body.page-staking .stake-card-title {
    margin: 0 0 8px;
  }

  body.page-staking .stake-hero-row {
    column-gap: 12px;
  }

  body.page-staking .stake-hero-amount {
    font-size: clamp(18px, 1.9vw, 24px);
  }

  body.page-staking .stake-hero-approx {
    font-size: clamp(16px, 1.6vw, 22px);
  }

  body.page-staking .stake-hero-sol {
    font-size: clamp(13px, 1.3vw, 15px);
  }

  body.page-staking .stake-hero-usd {
    font-size: clamp(11px, 1.1vw, 12px);
  }

  body.page-staking .stake-metrics {
    gap: 8px;
  }

  body.page-staking .stake-metric {
    padding: 8px 10px;
  }

  body.page-staking .stake-action-btn {
    min-height: 40px;
    padding: 8px 10px;
  }

  body.page-staking .stake-calc-input {
    min-height: 40px;
  }

  body.page-staking .stake-card[data-stake-section="chart"].is-empty {
    padding-top: 10px;
    padding-bottom: 8px;
  }

  body.page-staking .stake-card[data-stake-section="chart"].is-empty .stake-empty {
    margin: 0;
    padding: 0;
  }

  body.page-staking .stake-card[data-stake-section="chart"].is-empty .stake-chart-wrap {
    min-height: 0;
    height: auto;
  }

  body.page-staking .stake-card[data-stake-section="chart"].is-empty .stake-chart-svg {
    display: none;
  }

  body.page-staking .stake-chart-svg {
    height: 190px;
  }

  body.page-staking .stake-history-scroll.is-long {
    max-height: 280px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
  }

  body.page-staking .stake-history-item {
    padding: 8px 10px;
  }
}

@media (max-width: 1023px) {
  body.page-staking .stake-page-intro {
    margin: 0 0 8px;
    max-width: none;
  }

  body.page-staking .stake-page-lead {
    font-size: 13px;
    line-height: 1.4;
  }

  body.page-staking .stake-cabinet {
    gap: 10px;
  }

  body.page-staking .stake-card {
    padding: 12px 12px 10px;
    border-radius: 12px;
  }

  body.page-staking .stake-hero-row {
    column-gap: 8px;
  }

  body.page-staking .stake-hero-amount {
    font-size: clamp(16px, 4.6vw, 22px);
  }

  body.page-staking .stake-hero-approx {
    font-size: clamp(15px, 4vw, 20px);
  }

  body.page-staking .stake-hero-sol {
    font-size: clamp(12px, 3.4vw, 14px);
  }

  body.page-staking .stake-hero-usd {
    font-size: clamp(10px, 2.8vw, 12px);
  }

  /* Keep Expected income as 3 columns across phone width (iOS / Android / mobile web) */
  body.page-staking .stake-forecast-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  body.page-staking .stake-forecast-item {
    min-width: 0;
    padding: 8px 6px;
    box-sizing: border-box;
  }

  body.page-staking .stake-forecast-item .stake-metric-label {
    font-size: 10px;
    line-height: 1.25;
    margin-bottom: 3px;
  }

  body.page-staking .stake-forecast-item .stake-metric-value {
    font-size: 13px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  body.page-staking .stake-forecast-item .stake-metric-sub {
    font-size: 10px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  body.page-staking main.page-main > .layout.pools-layout {
    display: flex;
    flex-direction: column;
  }

  /* iOS: avoid focus-zoom on amount field; larger tap targets */
  body.page-staking .stake-calc-input {
    font-size: 16px;
    min-height: 48px;
  }

  body.page-staking .stake-action-btn,
  body.page-staking .stake-chip,
  body.page-staking .stake-chart-tab {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(56, 189, 248, 0.18);
  }

  body.page-staking .stake-chip,
  body.page-staking .stake-chart-tab {
    min-height: 44px;
    padding: 10px 12px;
  }

  body.page-staking .stake-chart-svg {
    height: 128px;
  }

  body.page-staking .stake-history-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  body.page-staking .stake-history-meta {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  body.page-staking .stake-metrics {
    grid-template-columns: 1fr;
  }
  body.page-staking .stake-actions {
    flex-direction: column;
  }
  body.page-staking .stake-action-btn {
    width: 100%;
  }
  body.page-staking .stake-calc-row {
    flex-direction: column;
    align-items: stretch;
  }
  body.page-staking .stake-calc-input {
    flex: 1 1 auto;
    width: 100%;
  }
  body.page-staking .stake-card {
    padding: 10px 10px 9px;
  }

  body.page-staking .stake-forecast-grid {
    gap: 5px;
  }

  body.page-staking .stake-forecast-item {
    padding: 7px 5px;
  }

  body.page-staking .stake-forecast-item .stake-metric-value {
    font-size: 12px;
  }
}

/* RTL */
html[dir="rtl"] body.page-staking .stake-history-item,
body.page-staking[dir="rtl"] .stake-history-item {
  direction: rtl;
}
