:root {
  --primary: #5b3df5;
  --primary-dark: #4527d1;
  --primary-light: #efeaff;
  --accent: #ff5e94;
  --success: #17b26a;
  --warning: #f5a524;
  --danger: #f04438;
  --bg: #f4f5fb;
  --card: #ffffff;
  --text: #1c1b2e;
  --text-muted: #78778f;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 24px rgba(50, 40, 120, 0.08);
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  padding-bottom: 84px; /* espacio para la barra inferior en móvil */
}

/* ---------- Topbar tipo app ---------- */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 18px 20px 26px;
  border-radius: 0 0 24px 24px;
  box-shadow: var(--shadow);
}
.app-topbar h1 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}
.app-topbar .subtitle {
  font-size: .82rem;
  opacity: .85;
}
.app-topbar .avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

.app-container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.app-content { margin-top: -14px; }

/* ---------- Tarjetas ---------- */
.card-app {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: none;
  padding: 18px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat-card .icon {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  flex-shrink: 0;
}
.stat-card .value { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.stat-card .label { font-size: .78rem; color: var(--text-muted); }

.bg-grad-primary { background: linear-gradient(135deg, var(--primary), #8a6dff); }
.bg-grad-success { background: linear-gradient(135deg, #17b26a, #57d38c); }
.bg-grad-warning { background: linear-gradient(135deg, #f5a524, #ffcf70); }
.bg-grad-accent  { background: linear-gradient(135deg, #ff5e94, #ff8fb3); }

/* ---------- Progreso hacia el premio ---------- */
.premio-progress {
  height: 14px;
  border-radius: 20px;
  background: var(--primary-light);
  overflow: hidden;
}
.premio-progress .bar {
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width .4s ease;
}

/* ---------- Botones ---------- */
.btn-app {
  border-radius: 14px;
  font-weight: 600;
  padding: .6rem 1.1rem;
  border: none;
}
.btn-app-primary { background: var(--primary); color: #fff; }
.btn-app-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-app-ghost { background: var(--primary-light); color: var(--primary-dark); }

/* ---------- Tablas ---------- */
.table-app { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.table-app thead th {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: none;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 12px 14px;
}
.table-app td { padding: 12px 14px; vertical-align: middle; font-size: .92rem; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
}
.chip-success { background: #e6f9f0; color: var(--success); }
.chip-warning { background: #fef3dd; color: #b5790a; }
.chip-danger  { background: #fde8e6; color: var(--danger); }
.chip-muted   { background: #eef0f7; color: var(--text-muted); }

/* ---------- Barra inferior (mobile-app feel) ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff;
  box-shadow: 0 -6px 20px rgba(50,40,120,.10);
  display: flex;
  z-index: 50;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  padding: 8px 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .68rem;
  border-radius: 12px;
}
.bottom-nav a i { font-size: 1.25rem; }
.bottom-nav a.active { color: var(--primary); background: var(--primary-light); }

/* ---------- Sidebar de escritorio ---------- */
@media (min-width: 992px) {
  body { padding-bottom: 0; }
  .bottom-nav { display: none; }
  .desktop-shell { display: flex; min-height: 100vh; }
  .desktop-sidebar {
    width: 240px; background: #fff;
    border-right: 1px solid #eceaf7;
    padding: 24px 16px;
    position: sticky; top: 0; height: 100vh;
  }
  .desktop-sidebar a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: 12px;
    color: var(--text-muted); text-decoration: none;
    font-weight: 600; font-size: .9rem; margin-bottom: 4px;
  }
  .desktop-sidebar a.active, .desktop-sidebar a:hover { background: var(--primary-light); color: var(--primary-dark); }
  .desktop-main { flex: 1; padding: 24px 32px; }
  .app-topbar { display: none; }
}
@media (max-width: 991.98px) {
  .desktop-sidebar { display: none; }
}

.login-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--primary), #8a6dff 60%, var(--accent));
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 24px; box-shadow: var(--shadow);
  padding: 36px 28px; width: 100%; max-width: 380px;
}
.login-logo {
  width: 64px; height: 64px; border-radius: 18px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; margin: 0 auto 14px;
}
