/* ============================================================
   Family Bank — Design System & Styles
   ============================================================ */

/* ── Reset & Variables ── */
:root {
  --bg-dark: #0b1120;
  --bg-card: #131b2e;
  --bg-card-hover: #1a2540;
  --bg-surface: #1e293b;
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);

  --radius-sm: 0.5rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.75rem;

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ── */
.screen { display: none; }
.screen.active { display: block; }

/* ══════════════════════════════════
   PANTALLA DE SELECCIÓN DE USUARIO
   ══════════════════════════════════ */
.select-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(34, 197, 94, 0.06) 0%, transparent 50%),
    var(--bg-dark);
}

.logo-area {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInDown 0.6s ease;
}

.logo-icon {
  width: 56px;
  height: 56px;
  display: block;
  margin: 0 auto 1rem;
  filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.3));
}

.logo-area h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #e2e8f0 0%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

/* User Cards */
.user-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  max-width: 720px;
  width: 100%;
  animation: fadeInUp 0.6s ease 0.2s both;
}

.user-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.user-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent-glow) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}

.user-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 32px var(--accent-glow);
}

.user-card:hover::before { opacity: 1; }

.user-card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin: 0 auto 1rem;
  position: relative;
  z-index: 1;
}

.user-card-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  position: relative;
  z-index: 1;
}

.user-card-age {
  color: var(--text-secondary);
  font-size: 0.875rem;
  position: relative;
  z-index: 1;
}

.user-card-badge {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

/* User card color themes */
.user-card[data-age="7"] .user-card-avatar { background: linear-gradient(135deg, #f0abfc, #c084fc); }
.user-card[data-age="7"] .user-card-badge { background: rgba(192, 132, 252, 0.15); color: #c084fc; }
.user-card[data-age="14"] .user-card-avatar { background: linear-gradient(135deg, #6ee7b7, #34d399); }
.user-card[data-age="14"] .user-card-badge { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.user-card[data-age="21"] .user-card-avatar { background: linear-gradient(135deg, #93c5fd, #6366f1); }
.user-card[data-age="21"] .user-card-badge { background: rgba(99, 102, 241, 0.15); color: #818cf8; }

/* ══════════════════════════════════
   DASHBOARD
   ══════════════════════════════════ */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: rgba(11, 17, 32, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon-sm { font-size: 1.5rem; }

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #e2e8f0, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.kids-toggle-container {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.kids-toggle-container input {
  display: none;
}

.kids-toggle-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.kids-toggle-container input:checked + .kids-toggle-btn {
  background: rgba(244, 114, 182, 0.2);
  border-color: #f472b6;
  color: #f472b6;
  box-shadow: 0 0 10px rgba(244, 114, 182, 0.2);
}

.header-user {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.dash-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── Balance Card ── */
.balance-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .balance-container {
    grid-template-columns: 1fr;
  }
}

.balance-card {
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.balance-card.monedero {
  background: linear-gradient(135deg, #064e3b 0%, #047857 50%, #064e3b 100%);
  border: 1px solid rgba(16, 185, 129, 0.2);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.1);
}

.balance-card.hucha {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.1);
}

.balance-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -30%;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  position: relative;
  z-index: 1;
  margin-bottom: 0.5rem;
}

.card-top-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.card-bottom-actions {
  margin-top: auto;
  padding-top: 1rem;
  position: relative;
  z-index: 1;
  text-align: center;
}

.balance-top {
  position: relative;
  z-index: 1;
  margin-bottom: 1.5rem;
}

.balance-label {
  display: block;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.balance-amount {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  display: block;
  position: relative;
  z-index: 1;
}

.balance-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: auto;
  margin-bottom: 0;
  position: relative;
  z-index: 1;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
}

.form-select {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-select option {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 0.5rem;
}

/* ── Toast Notification ── */
.app-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.app-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.app-toast.toast-error {
  border-color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

.app-toast.toast-success {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.1);
}

.btn-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--primary);
  color: white;
  border: 2px solid var(--bg-body);
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  margin-left: 0.5rem;
  vertical-align: middle;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  transition: transform 0.2s, background-color 0.2s;
}

.btn-help:hover {
  transform: scale(1.1);
  background-color: var(--primary-hover);
}

.balance-meta {
  display: flex;
  gap: 1.5rem;
  position: relative;
  z-index: 1;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.meta-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.meta-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--accent-hover);
}

/* ── Rebajas Alert ── */
.rebajas-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--amber-bg);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
  animation: pulse 2s infinite;
}

.rebajas-icon { font-size: 1.25rem; }
.rebajas-text { font-weight: 600; color: var(--amber); font-size: 0.9rem; }

/* ── Sections ── */
.section { }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-header h3,
.section > h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.section-header h3 { margin-bottom: 0; }

/* ── Assets Grid ── */
.assets-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.asset-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all var(--transition);
  cursor: default;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative; /* Added for absolute children */
}

.asset-risk-top {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.asset-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.asset-card.on-sale {
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.08);
}

.asset-card.on-sale .sale-badge {
  display: inline-block;
}

.sale-badge {
  display: none;
  background: var(--amber-bg);
  color: var(--amber);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.asset-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.asset-emoji {
  font-size: 1.75rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
}

.asset-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}

.asset-ticker {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.125rem;
}

.asset-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  margin-top: auto;
}

.asset-price {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.asset-change {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.asset-change.up { color: var(--green); background: var(--green-bg); }
.asset-change.down { color: var(--red); background: var(--red-bg); }
.asset-change.kids-text { font-size: 0.95rem; font-weight: 700; background: transparent; padding: 0; }

.asset-risk {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.asset-risk-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.asset-risk-top .asset-risk-label {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.asset-risk-top .risk-bar {
  width: 60px;
  margin: 0;
}

.risk-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.risk-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
}

.asset-card .btn {
  width: 100%;
  justify-content: center;
  font-size: 0.85rem;
  padding: 0.6rem;
}

/* ── Investments List ── */
.investments-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.investment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

.inv-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.inv-emoji { font-size: 1.25rem; }

.inv-name { font-weight: 600; font-size: 0.9rem; }
.inv-shares { color: var(--text-muted); font-size: 0.8rem; }

.inv-right { text-align: right; }
.inv-value { font-weight: 700; font-size: 1rem; }
.inv-avg { color: var(--text-muted); font-size: 0.75rem; }

/* ── Ledger List ── */
.ledger-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.ledger-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.ledger-type-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.ledger-type-icon.INGRESO { background: var(--green-bg); }
.ledger-type-icon.COMPRA { background: rgba(99, 102, 241, 0.12); }
.ledger-type-icon.DIVIDENDO { background: var(--amber-bg); }
.ledger-type-icon.RETIRO { background: var(--red-bg); }

.ledger-desc { font-size: 0.85rem; font-weight: 500; }
.ledger-date { color: var(--text-muted); font-size: 0.75rem; }

.ledger-amount {
  font-weight: 700;
  font-size: 0.9rem;
}
.ledger-amount.positive { color: var(--green); }
.ledger-amount.negative { color: var(--red); }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
  font-size: 0.9rem;
}

/* ══════════════════════════════════
   BUTTONS
   ══════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.btn-danger {
  background: var(--red);
  color: white;
}
.btn-danger:hover { background: #dc2626; }

.asset-invested-badge {
  background-color: var(--card-bg);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.asset-profit {
  font-size: 0.8rem;
  font-weight: 500;
}

.asset-profit.positive {
  color: var(--green);
}
.asset-profit.negative {
  color: var(--red);
}

.asset-history {
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
}
.dark-mode .asset-history {
  background: rgba(255, 255, 255, 0.05);
}

.asset-history-title {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  letter-spacing: 0.5px;
}

.asset-history-list {
  list-style: none;
  font-size: 0.85rem;
}

.asset-history-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border-color);
}
.asset-history-list li:last-child {
  border-bottom: none;
}

.block-badge {
  display: inline-block;
  background-color: var(--red);
  color: white;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 10px;
  margin-left: 0.5rem;
}
.block-badge.unlocked {
  background-color: var(--green);
}

.btn-buy {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.2);
}
.btn-buy:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--green);
}

.btn-buy:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
  align-items: center;
}

.btn-icon:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex;
  align-items: center;
}
.btn-text:hover { color: var(--text-primary); }

.btn-help {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  vertical-align: middle;
  margin-left: 0.375rem;
}
.btn-help:hover { border-color: var(--accent); color: var(--accent); }

/* ── Asset Details Box & Sparkline ── */
.asset-details-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 1rem 0;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  font-size: 0.85rem;
}

.detail-row.total {
  border-top: 1px dashed var(--border);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.detail-label {
  color: var(--text-secondary);
}

.detail-value {
  font-weight: 600;
}

.detail-value.positive { color: var(--green); }
.detail-value.negative { color: var(--red); }

.sparkline-container {
  margin-top: 1rem;
  height: 60px; /* Increased to make room for x-axis */
  width: 100%;
  position: relative;
  overflow: hidden;
}

.sparkline-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

.sparkline-svg {
  width: 100%;
  height: 40px;
  display: block;
}

.sparkline-x-axis {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}

.asset-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: auto;
}

/* ── Simulation Modal ── */
.sim-options {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sim-slider {
  width: 100%;
  margin-top: 0.5rem;
  accent-color: var(--accent);
}

.sim-result-box {
  text-align: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(16, 185, 129, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
}

.sim-result-box h4 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.sim-total-amount {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ══════════════════════════════════
   MODALS
   ══════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  animation: scaleIn 0.25s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  flex-shrink: 0;
}

.modal-header h3 { font-size: 1.1rem; font-weight: 700; }

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  transition: color var(--transition);
}
.btn-close:hover { color: var(--text-primary); }

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-shrink: 0;
}

.modal-asset-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
}

.modal-emoji { font-size: 2rem; }
.modal-asset-name { font-weight: 700; }
.modal-asset-price { color: var(--text-secondary); font-size: 0.9rem; }

.modal-info {
  padding: 0.875rem 1rem;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--accent-hover);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.alert-warning {
  padding: 0.875rem 1rem;
  background: var(--red-bg);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--red);
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

/* ── Bonus Info (Bank Card) ── */
.bonus-info {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bonus-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.bonus-label {
  color: var(--text-secondary);
}

.bonus-val {
  font-weight: 600;
}

.bonus-val.locked { color: var(--text-muted); }
.bonus-val.ready { color: var(--green); }

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* ── Trade Modal Tabs ── */
.trade-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.25rem;
  border-radius: var(--radius-md);
}

.trade-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 0.625rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
}

.trade-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ── Sparkline Dates ── */
.sparkline-x-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ── Form ── */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.1rem;
  font-family: var(--font);
  font-weight: 600;
  transition: border-color var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group input::placeholder { color: var(--text-muted); }

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

/* ── Custom Checkboxes ── */
.reset-options {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-surface);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.custom-checkbox {
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

.custom-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkmark {
  height: 22px;
  width: 22px;
  background-color: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 6px;
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.custom-checkbox:hover input ~ .checkmark {
  border-color: var(--primary);
  background-color: rgba(99, 102, 241, 0.1);
}

.custom-checkbox input:checked ~ .checkmark {
  background-color: var(--primary);
  border-color: var(--primary);
}

.checkmark:after {
  content: "";
  display: none;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.custom-checkbox input:checked ~ .checkmark:after {
  display: block;
}

.chk-label {
  flex: 1;
}

/* ── Configuración (Sueldo) ── */
#modal-config .modal { max-width: 540px; }

.config-user-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.6rem;
}

.config-user-block h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.config-row {
  display: grid;
  grid-template-columns: 90px 1fr 110px;
  gap: 0.5rem;
  align-items: end;
}

.config-row .form-group {
  margin-bottom: 0;
}

.config-row label {
  font-size: 0.72rem;
  margin-bottom: 0.2rem;
  color: var(--text-muted);
  font-weight: 500;
}

.config-row input,
.config-row select {
  font-size: 0.85rem;
  padding: 0.4rem 0.5rem;
  width: 100%;
}

.config-day-slot.hidden {
  visibility: hidden;
}

/* ── Utilities ── */
.hidden { display: none !important; }

.spinning { animation: spin 1s linear infinite; }

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .balance-amount { font-size: 2rem; }
  .balance-meta { flex-wrap: wrap; gap: 1rem; }
  .assets-grid { grid-template-columns: 1fr 1fr; }
  .user-cards { grid-template-columns: 1fr; max-width: 280px; }
  .dash-main { padding: 1rem; }
  .balance-card { padding: 1.5rem; }
}

@media (max-width: 420px) {
  .assets-grid { grid-template-columns: 1fr; }
  .balance-actions { flex-direction: column; }
}
