:root {
  --bg: #05070f;
  --panel: #0a1020;
  --panel-2: #0b1226;
  --text: #f6f7fb;
  --muted: #9da9d1;
  --line: rgba(255,255,255,0.08);
  --primary: #3b1dff;
  --success: #39ff14;
  --gold: #ffe600;
  --danger: #ff5f6d;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, sans-serif; background: radial-gradient(circle at top left, #0b1330, var(--bg) 35%); color: var(--text); }
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: #050913; color: var(--text);
}
textarea { min-height: 110px; resize: vertical; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 13px 18px; background: rgba(255,255,255,0.08); color: var(--text); cursor: pointer;
}
.btn.primary { background: linear-gradient(90deg, #2d14df, #5136ff); }
.btn.success { background: rgba(57,255,20,0.18); color: #9dff8e; }
.btn.danger { background: rgba(255,95,109,0.18); color: #ffb0b8; }
.btn.small { padding: 8px 12px; border-radius: 10px; }
.page-title { margin: 0 0 24px; font-size: 2rem; }
.app-shell { display: grid; grid-template-columns: 290px 1fr; min-height: 100vh; }
.sidebar { padding: 24px 16px; border-right: 1px solid var(--line); background: rgba(0,0,0,0.42); }
.brand { font-size: 1.8rem; font-weight: 800; margin-bottom: 24px; }
.wallet-card, .panel, .metric-card, .auth-card { background: linear-gradient(180deg, rgba(9,15,33,0.98), rgba(4,7,17,0.98)); border: 1px solid var(--line); border-radius: 22px; }
.wallet-card { padding: 18px; margin-bottom: 18px; }
.wallet-value { font-size: 2rem; font-weight: 800; margin-top: 6px; }
.nav-links { display: grid; gap: 10px; }
.nav-links a { padding: 14px 16px; border-radius: 14px; color: var(--text); }
.nav-links a.active, .nav-links a:hover { background: linear-gradient(90deg, #2310ab, #3619f3); }
.content { padding: 28px; }
.cards-grid { display: grid; gap: 18px; }
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.layout-main { grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr); align-items: start; }
.metric-card { padding: 24px; min-height: 170px; }
.metric-card.blue { background: linear-gradient(135deg, #0a1030, #06112c 65%, #081f54); }
.metric-card.blue-soft { background: linear-gradient(135deg, #10122c, #091432 70%, #083764); }
.metric-card.green { background: linear-gradient(135deg, #08170d, #08130f 60%, #114e1c); }
.metric-card.gold { background: linear-gradient(135deg, #181404, #121007 60%, #554200); }
.card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.card-subtitle { font-size: 0.98rem; color: var(--muted); margin-bottom: 10px; }
.card-big { font-size: 2.35rem; font-weight: 800; margin: 18px 0 10px; }
.panel { padding: 22px; }
.panel.compact { padding: 18px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-header h2, .panel h3 { margin: 0; }
.big-number { font-size: 2rem; font-weight: 800; margin: 10px 0; }
.muted { color: var(--muted); }
.mt-12 { margin-top: 12px; }
.mt-24 { margin-top: 24px; }
.stack-form { display: grid; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.public-shell { min-height: 100vh; padding: 32px; }
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; max-width: 1400px; margin: 0 auto; align-items: start; }
.hero-copy h1 { font-size: 3.4rem; line-height: 1.05; margin: 8px 0 16px; max-width: 900px; }
.hero-copy p { color: var(--muted); font-size: 1.1rem; max-width: 740px; }
.eyebrow { color: #8ca2ff; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; }
.cta-row { display: flex; gap: 12px; margin-top: 22px; }
.hero-cards { display: grid; gap: 18px; }
.auth-card { width: min(460px, 100%); margin: 8vh auto; padding: 28px; }
.auth-card.wide { width: min(520px, 100%); }
.flash-wrap { display: grid; gap: 10px; margin-bottom: 18px; }
.flash-wrap.public { max-width: 1200px; margin: 0 auto 18px; }
.flash { padding: 14px 16px; border-radius: 12px; }
.flash.success { background: rgba(57,255,20,0.15); color: #b9ffaf; }
.flash.error { background: rgba(255,95,109,0.18); color: #ffc0c5; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.inline { display: inline-flex; margin-right: 8px; }
.text-green { color: #7fff63; }
.text-red { color: #ff7f8a; }
.strategy-block { margin-top: 20px; }
.strategy-title { margin-bottom: 12px; color: var(--muted); font-weight: 600; }
.chart-panel canvas, .strategy-block canvas { width: 100% !important; height: 260px !important; }
.stack-col { display: grid; gap: 18px; }
.stats-inline { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 0.95rem; }
@media (max-width: 1100px) {
  .cards-3, .cards-4, .layout-main, .hero { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .content, .public-shell { padding: 18px; }
  .hero-copy h1 { font-size: 2.3rem; }
  .grid-3 { grid-template-columns: 1fr; }
}

.cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mt-16 { margin-top: 16px; }
.compact-cards { align-items: stretch; }
label { display: block; margin-bottom: 8px; color: var(--muted); }
#simulation-status { align-self: center; }
@media (max-width: 1100px) {
  .cards-2, .grid-2 { grid-template-columns: 1fr; }
}

.table-wrap { overflow-x: auto; }
.return-rate-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px; align-items: end; }
@media (max-width: 800px) {
  .return-rate-row { grid-template-columns: 1fr; }
}

.video-emoji-btn {
  min-width: 42px;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--line);
  font-size: 1.15rem;
  line-height: 1;
}
.video-emoji-btn:hover { background: rgba(255,255,255,0.18); transform: translateY(-1px); }
.video-modal[hidden] { display: none; }
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.video-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
}
.video-modal__window {
  position: relative;
  z-index: 1;
  width: min(980px, 94vw);
  max-height: 92vh;
  background: #060a14;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.45);
  overflow: hidden;
}
.video-modal__window:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
.video-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
}
.video-modal__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.video-modal video {
  display: block;
  width: 100%;
  max-height: calc(92vh - 72px);
  background: #000;
}
.video-modal__window:fullscreen video {
  flex: 1;
  max-height: none;
  object-fit: contain;
}
@media (max-width: 800px) {
  .video-modal { padding: 10px; }
  .video-modal__header { align-items: flex-start; flex-direction: column; }
  .video-modal__window { width: 100%; }
}

.return-pill {
    align-self: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.08);
}

.compact-list {
    gap: 0.7rem;
}

.strategy-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.stacked-form select {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    padding: 0.8rem 1rem;
    background: rgba(5, 10, 23, 0.8);
    color: var(--text);
}

.small {
    font-size: 0.84rem;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}
.page-head .page-title { margin-bottom: 0; }
.btn:disabled, button:disabled { opacity: 0.55; cursor: not-allowed; }
.rent-display { font-size: 1.75rem; margin: 10px 0; }
@media (max-width: 800px) {
  .page-head { align-items: flex-start; flex-direction: column; }
}

.metric-card.orange { background: linear-gradient(135deg, #1c0d04, #160f08 62%, #643000); }
.affiliate-hero { align-items: stretch; }
.affiliate-panel { max-width: 1100px; margin: 0 auto; }
.url-display {
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
}
.table-wrap .url-display { min-width: 280px; }

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 22px;
  padding: 8px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}
.admin-tab {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 18px;
  background: transparent;
  color: var(--muted);
}
.admin-tab:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}
.admin-tab.active {
  background: linear-gradient(90deg, #2310ab, #3619f3);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.14);
}
.admin-tab-panel[hidden] { display: none !important; }
@media (max-width: 800px) {
  .admin-tabs { width: 100%; }
  .admin-tab { flex: 1 1 150px; }
}

/* Históricos: lectura más clara */
.striped-table tbody tr:nth-child(even) {
  background: rgba(148, 163, 184, 0.12);
}
.striped-table tbody tr:nth-child(odd) {
  background: transparent;
}
.striped-table tbody tr:hover {
  background: rgba(148, 163, 184, 0.20);
}
.history-table .date-col,
.admin-history-table .date-col {
  min-width: 150px;
  white-space: nowrap;
}
.admin-history-table th:first-child,
.admin-history-table td:first-child {
  min-width: 170px;
  white-space: nowrap;
}
.inline-label {
  display: inline-block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}
.affiliate-commission-row input {
  margin-bottom: 0;
}
