/**
 * Pillar screen rebuild — space-marble atmosphere, glass cards, 4/8/16/24/32 rhythm.
 * Consumed by Body / Fuel / Wealth / Mind / Recharge / Mastery.
 */

:root {
  --pillar-space: 4px;
  --pillar-radius: 18px;
  --pillar-glass-bg: rgba(12, 14, 28, 0.55);
  --pillar-glass-border: rgba(255, 255, 255, 0.1);
  --pillar-spring: cubic-bezier(0.32, 0.72, 0, 1);
}

/* Space marble — nebula depth under pillar content */
.v2-section[data-pillar-screen]::before,
.pillar-detail-panel.open::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(80, 60, 160, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 85% 30%, rgba(30, 90, 160, 0.14), transparent 50%),
    radial-gradient(ellipse 70% 50% at 50% 90%, rgba(120, 40, 100, 0.12), transparent 55%),
    radial-gradient(circle at 30% 60%, rgba(255, 255, 255, 0.03) 0 1px, transparent 1.5px),
    radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.04) 0 1px, transparent 1.5px),
    radial-gradient(circle at 55% 45%, rgba(255, 255, 255, 0.025) 0 1px, transparent 1.5px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 180px 180px, 220px 220px, 140px 140px;
  animation: pillar-marble-drift 48s ease-in-out infinite alternate;
  opacity: 0.9;
}

@keyframes pillar-marble-drift {
  0% { background-position: 0% 0%, 0% 0%, 0% 0%, 0 0, 0 0, 0 0; }
  100% { background-position: 4% 2%, -3% 3%, 2% -2%, 24px 12px, -18px 20px, 10px -14px; }
}

.v2-section[data-pillar-screen] > *,
.pillar-detail-panel.open > * {
  position: relative;
  z-index: 1;
}

/* Glassmorphic cards */
.v2-section[data-pillar-screen] .v2-card-inner,
.pillar-detail-panel .pillar-detail-section,
.mind-section,
.mastery-section,
.recharge-section {
  background: var(--pillar-glass-bg) !important;
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid var(--pillar-glass-border);
  border-radius: var(--pillar-radius);
  padding: 20px 16px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 12px 32px rgba(0, 0, 0, 0.35);
}

#v2-section-workout .v2-card-inner {
  border-color: rgba(33, 150, 243, 0.28);
  box-shadow: 0 0 24px rgba(33, 150, 243, 0.08), 0 12px 32px rgba(0, 0, 0, 0.35);
}
#v2-section-nutrition .v2-card-inner {
  border-color: rgba(255, 107, 0, 0.28);
  box-shadow: 0 0 24px rgba(255, 107, 0, 0.08), 0 12px 32px rgba(0, 0, 0, 0.35);
}
#v2-section-budget .v2-card-inner {
  border-color: rgba(255, 214, 0, 0.32);
  box-shadow: 0 0 24px rgba(255, 214, 0, 0.1), 0 12px 32px rgba(0, 0, 0, 0.35);
}
.pillar-detail-panel[data-pillar-screen="mind"] .mind-section {
  border-color: rgba(155, 89, 255, 0.3);
}
.pillar-detail-panel[data-pillar-screen="recharge"] .recharge-section {
  border-color: rgba(0, 200, 83, 0.28);
}
.pillar-detail-panel[data-pillar-screen="mastery"] .mastery-section,
.pillar-detail-panel[data-pillar-screen="mastery"] .edge-section {
  border-color: rgba(255, 149, 0, 0.3);
}

/* Body — weight log: full-width bar above button, no layout shift */
.wk-weight-log {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 96px;
}
.wk-weight-log input#wk-weight-input {
  width: 100%;
  flex: none;
  min-height: 48px;
  box-sizing: border-box;
  font-size: 18px;
  font-weight: 700;
  font-family: var(--mono);
  text-align: center;
  border-radius: 12px;
  border: 1px solid rgba(33, 150, 243, 0.35);
  background: rgba(33, 150, 243, 0.08);
}
.wk-weight-log .wk-log-btn {
  width: 100%;
}
.wk-physique-top {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.wk-physique-top .section-label { margin-top: 0; }

/* Fuel — meal row with recipe expand */
.nut-meal-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.25s var(--pillar-spring);
  border-radius: 12px;
  margin: 0 -4px;
  padding-left: 8px;
  padding-right: 8px;
}
.nut-meal-row:active { background: rgba(255, 107, 0, 0.08); }
.nut-meal-row.open {
  background: rgba(255, 107, 0, 0.06);
  border-color: transparent;
}
.nut-meal-detail {
  grid-column: 1 / -1;
  display: none;
  gap: 12px;
  padding: 12px 0 8px;
  animation: pillar-fade-up 0.35s var(--pillar-spring);
}
.nut-meal-row.open .nut-meal-detail {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: start;
}
.nut-meal-thumb {
  width: 88px;
  height: 88px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255, 107, 0, 0.12);
  border: 1px solid rgba(255, 107, 0, 0.25);
}
.nut-meal-recipe {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}
.nut-meal-recipe strong { color: var(--text); display: block; margin-bottom: 4px; }

@keyframes pillar-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Fuel weekly trend — visual even when empty */
.nut-trend-card { padding: 16px !important; }
.nut-trend-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  height: 140px;
  padding: 8px 4px 0;
}
.nut-trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  gap: 8px;
}
.nut-trend-bar-wrap {
  width: 100%;
  height: 100px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, rgba(255, 107, 0, 0.06), transparent);
}
.nut-trend-bar-fill {
  width: 72%;
  max-width: 28px;
  min-height: 6px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #FF9A3C, #FF6B00);
  box-shadow: 0 0 12px rgba(255, 107, 0, 0.4);
  transition: height 0.5s var(--pillar-spring);
}
.nut-trend-bar-fill.is-empty {
  background: linear-gradient(180deg, rgba(255, 107, 0, 0.22), rgba(255, 107, 0, 0.08));
  box-shadow: none;
  min-height: 8px;
  height: 12% !important;
}
.nut-trend-lbl {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted);
  text-align: center;
  width: 100%;
}
.nut-trend-empty-hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 12px;
  line-height: 1.45;
}

/* Wealth — Plaid trust surface (gold identity, clean Link-like flow) */
.wealth-plaid-card {
  margin: 0;
  padding: 20px 16px;
  border-radius: var(--pillar-radius);
  background: linear-gradient(165deg, rgba(255, 214, 0, 0.1), rgba(12, 14, 28, 0.7));
  border: 1px solid rgba(255, 214, 0, 0.28);
  box-shadow: 0 0 28px rgba(255, 214, 0, 0.08);
}
.wealth-plaid-card h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  color: #FFE566;
  letter-spacing: -0.02em;
}
.wealth-plaid-card .wealth-plaid-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 16px;
}
.wealth-plaid-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.wealth-plaid-trust span {
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 214, 0, 0.15);
  color: rgba(255, 230, 140, 0.85);
}
.wealth-plaid-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.45;
}
.wealth-plaid-consent input { margin-top: 2px; accent-color: #FFD600; }
.wealth-plaid-cta {
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  background: linear-gradient(180deg, #FFE566, #FFD600);
  color: #1a1500;
  box-shadow: 0 4px 16px rgba(255, 214, 0, 0.25);
  transition: transform 0.25s var(--pillar-spring), box-shadow 0.25s var(--pillar-spring);
}
.wealth-plaid-cta:active { transform: scale(0.98); }
.wealth-plaid-cta:disabled { opacity: 0.55; cursor: wait; }
.wealth-plaid-connected-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.wealth-plaid-badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 214, 0, 0.12);
  border: 1px solid rgba(255, 214, 0, 0.3);
  color: #FFE566;
  white-space: nowrap;
}
.wealth-plaid-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.wealth-plaid-actions button {
  flex: 1;
  min-height: 44px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}
.wealth-budget-hero {
  text-align: center;
  padding: 8px 0 4px;
}
.wealth-budget-hero .amt {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1.5px;
  color: #FFE566;
  line-height: 1.1;
}
.wealth-budget-hero .lbl {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

/* Recharge — synced metrics as displays */
.recharge-metric-grid {
  display: grid;
  gap: 12px;
}
.recharge-metric {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(0, 200, 83, 0.06);
  border: 1px solid rgba(0, 200, 83, 0.18);
}
.recharge-metric .label { font-size: 12px; color: #9ad4b0; grid-column: 1; }
.recharge-metric .value {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--mono);
  color: #6EFFA8;
  grid-column: 1;
}
.recharge-metric .source {
  font-size: 10px;
  color: var(--muted);
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  text-align: right;
}
.recharge-metric input {
  grid-column: 1;
  width: 100%;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(0, 200, 83, 0.25);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 16px;
}
.recharge-sync-badge.watch-only {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 200, 83, 0.12);
  border: 1px solid rgba(0, 200, 83, 0.35);
  color: #6EFFA8;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
}
.recharge-sync-badge[hidden] { display: none !important; }

/* Mastery aliases (edge → mastery) */
.mastery-section h4 { color: #FF9500; }
.mastery-feed-item,
.edge-feed-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 149, 0, 0.12);
}
.mastery-big-wins { display: grid; gap: 10px; }

/* Mind learning — no preemptive XP on CTA */
#mind-learning-btn {
  min-width: 88px;
}
.mind-reading-slot {
  margin-top: 8px;
}
